From b20d24eae484ce0ffcfe0e07d2cc098184fc01d1 Mon Sep 17 00:00:00 2001 From: aldettinger Date: Thu, 12 Dec 2024 10:07:42 +0100 Subject: [PATCH] Complete named AiService resolution test --- .../test/NamedAiServicesAreResolvableByNameTest.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/deployment/src/test/java/io/quarkiverse/langchain4j/test/NamedAiServicesAreResolvableByNameTest.java b/core/deployment/src/test/java/io/quarkiverse/langchain4j/test/NamedAiServicesAreResolvableByNameTest.java index 31797911c..ff6663ab3 100644 --- a/core/deployment/src/test/java/io/quarkiverse/langchain4j/test/NamedAiServicesAreResolvableByNameTest.java +++ b/core/deployment/src/test/java/io/quarkiverse/langchain4j/test/NamedAiServicesAreResolvableByNameTest.java @@ -1,9 +1,13 @@ package io.quarkiverse.langchain4j.test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.List; +import java.util.Set; +import jakarta.enterprise.inject.spi.Bean; import jakarta.enterprise.inject.spi.BeanManager; import jakarta.inject.Inject; import jakarta.inject.Named; @@ -51,6 +55,10 @@ public Response generate(List messages) { @Test void namedAiServiceCouldBeResolvedByNameTest() { - assertEquals(1, beanManager.getBeans(MY_NAMED_SERVICE_BEAN).size()); + Set> beans = beanManager.getBeans(MY_NAMED_SERVICE_BEAN); + assertEquals(1, beans.size()); + Bean bean = beans.iterator().next(); + assertNotNull(bean); + assertTrue(MyNamedService.class.isAssignableFrom(bean.getBeanClass())); } }