Skip to content

Commit 4f751cd

Browse files
committed
fix binder tests
1 parent 92ede94 commit 4f751cd

File tree

5 files changed

+15
-1
lines changed

5 files changed

+15
-1
lines changed

sdk/spring/spring-cloud-azure-stream-binder-eventhubs-core/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@
4646
<groupId>org.springframework.integration</groupId>
4747
<artifactId>spring-integration-core</artifactId>
4848
</exclusion>
49+
<exclusion>
50+
<groupId>io.projectreactor</groupId>
51+
<artifactId>reactor-core</artifactId>
52+
</exclusion>
4953
</exclusions>
5054
<version>5.0.0</version> <!-- {x-version-update;springboot4_org.springframework.cloud:spring-cloud-stream;external_dependency} -->
5155
</dependency>

sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/implementation/EventHubsHealthIndicatorTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public class EventHubsHealthIndicatorTests {
7878
public void init() {
7979
MockitoAnnotations.openMocks(this);
8080
GenericApplicationContext context = new GenericApplicationContext();
81+
context.refresh();
8182
binder.setApplicationContext(context);
8283
healthIndicator = new EventHubsHealthIndicator(binder);
8384
}

sdk/spring/spring-cloud-azure-stream-binder-eventhubs/src/test/java/com/azure/spring/cloud/stream/binder/eventhubs/implementation/EventHubsMessageChannelBinderTests.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ class EventHubsMessageChannelBinderTests {
4242
void init() {
4343
MockitoAnnotations.openMocks(this);
4444
when(producerDestination.getName()).thenReturn("producer-test");
45-
binder.setApplicationContext(new GenericApplicationContext());
45+
GenericApplicationContext context = new GenericApplicationContext();
46+
context.refresh();
47+
binder.setApplicationContext(context);
4648
}
4749

4850
@Test

sdk/spring/spring-cloud-azure-stream-binder-servicebus/src/test/java/com/azure/spring/cloud/stream/binder/servicebus/implementation/ServiceBusHealthIndicatorTests.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
import org.springframework.cloud.stream.provisioning.ConsumerDestination;
2929
import org.springframework.cloud.stream.provisioning.ProducerDestination;
3030
import org.springframework.context.support.GenericApplicationContext;
31+
import org.springframework.expression.spel.support.StandardEvaluationContext;
32+
import org.springframework.integration.context.IntegrationContextUtils;
3133
import org.springframework.integration.support.MessageBuilder;
3234
import org.springframework.messaging.MessageChannel;
3335
import org.springframework.test.util.ReflectionTestUtils;
@@ -74,6 +76,10 @@ class ServiceBusHealthIndicatorTests {
7476
void init() {
7577
MockitoAnnotations.openMocks(this);
7678
GenericApplicationContext context = new GenericApplicationContext();
79+
StandardEvaluationContext sec = new StandardEvaluationContext();
80+
when(beanFactory.containsBean(IntegrationContextUtils.INTEGRATION_EVALUATION_CONTEXT_BEAN_NAME)).thenReturn(true);
81+
when(beanFactory.getBean(IntegrationContextUtils.INTEGRATION_EVALUATION_CONTEXT_BEAN_NAME, StandardEvaluationContext.class)).thenReturn(sec);
82+
context.refresh();
7783
binder.setApplicationContext(context);
7884
serviceBusHealthIndicator = new ServiceBusHealthIndicator(binder);
7985
}

sdk/spring/spring-cloud-azure-stream-binder-servicebus/src/test/java/com/azure/spring/cloud/stream/binder/servicebus/implementation/ServiceBusMessageChannelBinderTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class ServiceBusMessageChannelBinderTest {
6464
void init() {
6565
MockitoAnnotations.openMocks(this);
6666
GenericApplicationContext context = new GenericApplicationContext();
67+
context.refresh();
6768
binder.setApplicationContext(context);
6869
}
6970

0 commit comments

Comments
 (0)