Skip to content

Commit

Permalink
Merge pull request #1153 from aldettinger/complete-ai-service-named-r…
Browse files Browse the repository at this point in the history
…esolution-test

Complete named AiService resolution test
  • Loading branch information
geoand authored Dec 12, 2024
2 parents 6ba6ee0 + b20d24e commit 8f364e7
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -51,6 +55,10 @@ public Response<AiMessage> generate(List<ChatMessage> messages) {

@Test
void namedAiServiceCouldBeResolvedByNameTest() {
assertEquals(1, beanManager.getBeans(MY_NAMED_SERVICE_BEAN).size());
Set<Bean<?>> beans = beanManager.getBeans(MY_NAMED_SERVICE_BEAN);
assertEquals(1, beans.size());
Bean<?> bean = beans.iterator().next();
assertNotNull(bean);
assertTrue(MyNamedService.class.isAssignableFrom(bean.getBeanClass()));
}
}

0 comments on commit 8f364e7

Please sign in to comment.