@@ -80,6 +80,11 @@ void whenNativeListenerIsEnabledThenContainerFactoryIsConfiguredToUseNativeListe
80
80
.extracting ("nativeListener" , InstanceOfAssertFactories .BOOLEAN ).isTrue ());
81
81
}
82
82
83
+ @ Test
84
+ void environmentIsAutoConfiguredByDefault () {
85
+ this .contextRunner .run ((context ) -> assertThat (context ).hasSingleBean (Environment .class ));
86
+ }
87
+
83
88
@ Test
84
89
void whenCustomEnvironmentIsDefinedThenAutoConfiguredEnvironmentBacksOff () {
85
90
this .contextRunner .withUserConfiguration (CustomEnvironmentConfiguration .class ).run ((context ) -> {
@@ -156,13 +161,11 @@ void whenStreamCredentialsAreSetThenEnvironmentUsesStreamCredentials() {
156
161
157
162
@ Test
158
163
void testDefaultRabbitStreamTemplateConfiguration () {
159
- this .contextRunner
160
- .withPropertyValues ("spring.rabbitmq.listener.type:stream" , "spring.rabbitmq.stream.name:stream-test" )
161
- .run ((context ) -> {
162
- assertThat (context ).hasSingleBean (RabbitStreamTemplate .class );
163
- assertThat (context .getBean (RabbitStreamTemplate .class )).hasFieldOrPropertyWithValue ("streamName" ,
164
- "stream-test" );
165
- });
164
+ this .contextRunner .withPropertyValues ("spring.rabbitmq.stream.name:stream-test" ).run ((context ) -> {
165
+ assertThat (context ).hasSingleBean (RabbitStreamTemplate .class );
166
+ assertThat (context .getBean (RabbitStreamTemplate .class )).hasFieldOrPropertyWithValue ("streamName" ,
167
+ "stream-test" );
168
+ });
166
169
}
167
170
168
171
@ Test
@@ -174,8 +177,7 @@ void testDefaultRabbitStreamTemplateConfigurationWithoutStreamName() {
174
177
@ Test
175
178
void testRabbitStreamTemplateConfigurationWithCustomMessageConverter () {
176
179
this .contextRunner .withUserConfiguration (MessageConvertersConfiguration .class )
177
- .withPropertyValues ("spring.rabbitmq.listener.type:stream" , "spring.rabbitmq.stream.name:stream-test" )
178
- .run ((context ) -> {
180
+ .withPropertyValues ("spring.rabbitmq.stream.name:stream-test" ).run ((context ) -> {
179
181
assertThat (context ).hasSingleBean (RabbitStreamTemplate .class );
180
182
RabbitStreamTemplate streamTemplate = context .getBean (RabbitStreamTemplate .class );
181
183
assertThat (streamTemplate ).hasFieldOrPropertyWithValue ("streamName" , "stream-test" );
@@ -189,8 +191,7 @@ void testRabbitStreamTemplateConfigurationWithCustomStreamMessageConverter() {
189
191
this .contextRunner
190
192
.withBean ("myStreamMessageConverter" , StreamMessageConverter .class ,
191
193
() -> mock (StreamMessageConverter .class ))
192
- .withPropertyValues ("spring.rabbitmq.listener.type:stream" , "spring.rabbitmq.stream.name:stream-test" )
193
- .run ((context ) -> {
194
+ .withPropertyValues ("spring.rabbitmq.stream.name:stream-test" ).run ((context ) -> {
194
195
assertThat (context ).hasSingleBean (RabbitStreamTemplate .class );
195
196
assertThat (context .getBean (RabbitStreamTemplate .class )).extracting ("messageConverter" )
196
197
.isSameAs (context .getBean ("myStreamMessageConverter" ));
@@ -201,8 +202,7 @@ void testRabbitStreamTemplateConfigurationWithCustomStreamMessageConverter() {
201
202
void testRabbitStreamTemplateConfigurationWithCustomProducerCustomizer () {
202
203
this .contextRunner
203
204
.withBean ("myProducerCustomizer" , ProducerCustomizer .class , () -> mock (ProducerCustomizer .class ))
204
- .withPropertyValues ("spring.rabbitmq.listener.type:stream" , "spring.rabbitmq.stream.name:stream-test" )
205
- .run ((context ) -> {
205
+ .withPropertyValues ("spring.rabbitmq.stream.name:stream-test" ).run ((context ) -> {
206
206
assertThat (context ).hasSingleBean (RabbitStreamTemplate .class );
207
207
assertThat (context .getBean (RabbitStreamTemplate .class )).extracting ("producerCustomizer" )
208
208
.isSameAs (context .getBean ("myProducerCustomizer" ));
0 commit comments