2121import  org .springframework .ai .mistralai .MistralAiChatModel ;
2222import  org .springframework .ai .mistralai .MistralAiEmbeddingModel ;
2323import  org .springframework .ai .mistralai .moderation .MistralAiModerationModel ;
24- import  org .springframework .boot .autoconfigure .AutoConfigurations ;
2524import  org .springframework .boot .test .context .runner .ApplicationContextRunner ;
2625
2726import  static  org .assertj .core .api .Assertions .assertThat ;
@@ -39,26 +38,23 @@ public class MistralModelConfigurationTests {
3938
4039	@ Test 
4140	void  chatModelActivation () {
42- 		this .contextRunner .withConfiguration (AutoConfigurations .of (MistralAiChatAutoConfiguration .class ))
43- 			.run (context  -> {
44- 				assertThat (context .getBeansOfType (MistralAiChatProperties .class )).isNotEmpty ();
45- 				assertThat (context .getBeansOfType (MistralAiChatModel .class )).isNotEmpty ();
46- 				assertThat (context .getBeansOfType (MistralAiEmbeddingProperties .class )).isEmpty ();
47- 				assertThat (context .getBeansOfType (MistralAiEmbeddingModel .class )).isEmpty ();
48- 				assertThat (context .getBeansOfType (MistralAiModerationProperties .class )).isEmpty ();
49- 				assertThat (context .getBeansOfType (MistralAiModerationModel .class )).isEmpty ();
50- 			});
51- 
52- 		this .contextRunner .withConfiguration (AutoConfigurations .of (MistralAiChatAutoConfiguration .class ))
41+ 		this .contextRunner .withConfiguration (BaseMistralAiIT .mistralAiChatAutoConfig ()).run (context  -> {
42+ 			assertThat (context .getBeansOfType (MistralAiChatProperties .class )).isNotEmpty ();
43+ 			assertThat (context .getBeansOfType (MistralAiChatModel .class )).isNotEmpty ();
44+ 			assertThat (context .getBeansOfType (MistralAiEmbeddingProperties .class )).isEmpty ();
45+ 			assertThat (context .getBeansOfType (MistralAiEmbeddingModel .class )).isEmpty ();
46+ 			assertThat (context .getBeansOfType (MistralAiModerationProperties .class )).isEmpty ();
47+ 			assertThat (context .getBeansOfType (MistralAiModerationModel .class )).isEmpty ();
48+ 		});
49+ 
50+ 		this .contextRunner .withConfiguration (BaseMistralAiIT .mistralAiChatAutoConfig ())
5351			.withPropertyValues ("spring.ai.model.chat=none" , "spring.ai.model.embedding=none" )
5452			.run (context  -> {
5553				assertThat (context .getBeansOfType (MistralAiChatProperties .class )).isEmpty ();
5654				assertThat (context .getBeansOfType (MistralAiChatModel .class )).isEmpty ();
5755			});
5856
59- 		this .contextRunner 
60- 			.withConfiguration (AutoConfigurations .of (MistralAiChatAutoConfiguration .class ,
61- 					MistralAiEmbeddingAutoConfiguration .class ))
57+ 		this .contextRunner .withConfiguration (BaseMistralAiIT .mistralAiChatAutoConfig ())
6258			.withPropertyValues ("spring.ai.model.chat=mistral" , "spring.ai.model.embedding=none" )
6359			.run (context  -> {
6460				assertThat (context .getBeansOfType (MistralAiChatProperties .class )).isNotEmpty ();
@@ -72,17 +68,17 @@ void chatModelActivation() {
7268
7369	@ Test 
7470	void  embeddingModelActivation () {
75- 		this .contextRunner .withConfiguration (AutoConfigurations . of ( MistralAiEmbeddingAutoConfiguration . class ))
71+ 		this .contextRunner .withConfiguration (BaseMistralAiIT . mistralAiEmbeddingAutoConfig ( ))
7672			.run (context  -> assertThat (context .getBeansOfType (MistralAiEmbeddingModel .class )).isNotEmpty ());
7773
78- 		this .contextRunner .withConfiguration (AutoConfigurations . of ( MistralAiEmbeddingAutoConfiguration . class ))
74+ 		this .contextRunner .withConfiguration (BaseMistralAiIT . mistralAiEmbeddingAutoConfig ( ))
7975			.withPropertyValues ("spring.ai.model.embedding=none" )
8076			.run (context  -> {
8177				assertThat (context .getBeansOfType (MistralAiEmbeddingProperties .class )).isEmpty ();
8278				assertThat (context .getBeansOfType (MistralAiEmbeddingModel .class )).isEmpty ();
8379			});
8480
85- 		this .contextRunner .withConfiguration (AutoConfigurations . of ( MistralAiEmbeddingAutoConfiguration . class ))
81+ 		this .contextRunner .withConfiguration (BaseMistralAiIT . mistralAiEmbeddingAutoConfig ( ))
8682			.withPropertyValues ("spring.ai.model.embedding=mistral" )
8783			.run (context  -> {
8884				assertThat (context .getBeansOfType (MistralAiEmbeddingProperties .class )).isNotEmpty ();
@@ -92,33 +88,30 @@ void embeddingModelActivation() {
9288
9389	@ Test 
9490	void  moderationModelActivation () {
95- 		this .contextRunner .withConfiguration (AutoConfigurations .of (MistralAiModerationAutoConfiguration .class ))
96- 			.run (context  -> {
97- 				assertThat (context .getBeansOfType (MistralAiModerationModel .class )).isNotEmpty ();
98- 				assertThat (context .getBeansOfType (MistralAiModerationProperties .class )).isNotEmpty ();
99- 				assertThat (context .getBeansOfType (MistralAiChatModel .class )).isEmpty ();
100- 				assertThat (context .getBeansOfType (MistralAiChatProperties .class )).isEmpty ();
101- 				assertThat (context .getBeansOfType (MistralAiEmbeddingProperties .class )).isEmpty ();
102- 				assertThat (context .getBeansOfType (MistralAiEmbeddingModel .class )).isEmpty ();
103- 			});
104- 
105- 		this .contextRunner .withConfiguration (AutoConfigurations .of (MistralAiModerationAutoConfiguration .class ))
91+ 		this .contextRunner .withConfiguration (BaseMistralAiIT .mistralAiModerationAutoConfig ()).run (context  -> {
92+ 			assertThat (context .getBeansOfType (MistralAiModerationModel .class )).isNotEmpty ();
93+ 			assertThat (context .getBeansOfType (MistralAiModerationProperties .class )).isNotEmpty ();
94+ 			assertThat (context .getBeansOfType (MistralAiChatModel .class )).isEmpty ();
95+ 			assertThat (context .getBeansOfType (MistralAiChatProperties .class )).isEmpty ();
96+ 			assertThat (context .getBeansOfType (MistralAiEmbeddingProperties .class )).isEmpty ();
97+ 			assertThat (context .getBeansOfType (MistralAiEmbeddingModel .class )).isEmpty ();
98+ 		});
99+ 
100+ 		this .contextRunner .withConfiguration (BaseMistralAiIT .mistralAiModerationAutoConfig ())
106101			.withPropertyValues ("spring.ai.model.moderation=none" )
107102			.run (context  -> {
108103				assertThat (context .getBeansOfType (MistralAiModerationProperties .class )).isEmpty ();
109104				assertThat (context .getBeansOfType (MistralAiModerationModel .class )).isEmpty ();
110105			});
111106
112- 		this .contextRunner .withConfiguration (AutoConfigurations . of ( MistralAiModerationAutoConfiguration . class ))
107+ 		this .contextRunner .withConfiguration (BaseMistralAiIT . mistralAiModerationAutoConfig ( ))
113108			.withPropertyValues ("spring.ai.model.moderation=mistral" )
114109			.run (context  -> {
115110				assertThat (context .getBeansOfType (MistralAiModerationProperties .class )).isNotEmpty ();
116111				assertThat (context .getBeansOfType (MistralAiModerationModel .class )).isNotEmpty ();
117112			});
118113
119- 		this .contextRunner 
120- 			.withConfiguration (AutoConfigurations .of (MistralAiChatAutoConfiguration .class ,
121- 					MistralAiEmbeddingAutoConfiguration .class , MistralAiModerationAutoConfiguration .class ))
114+ 		this .contextRunner .withConfiguration (BaseMistralAiIT .mistralAiModerationAutoConfig ())
122115			.withPropertyValues ("spring.ai.model.chat=none" , "spring.ai.model.embedding=none" ,
123116					"spring.ai.model.moderation=mistral" )
124117			.run (context  -> {
0 commit comments