dragon-zhang commented on code in PR #3529:
URL: https://github.com/apache/incubator-shenyu/pull/3529#discussion_r894985913
##########
shenyu-client/shenyu-client-http/shenyu-client-springcloud/src/test/java/org/apache/shenyu/client/springcloud/init/SpringCloudClientBeanPostProcessorTest.java:
##########
@@ -58,29 +58,31 @@ public final class SpringCloudClientBeanPostProcessorTest {
private final MockedStatic<RegisterUtils> registerUtilsMockedStatic =
mockStatic(RegisterUtils.class);
- private final SpringCloudClientTestBean springCloudClientTestBean = new
SpringCloudClientTestBean();
+ @Mock
+ private ApplicationContext applicationContext;
+
+ private ContextRefreshedEvent contextRefreshedEvent;
@BeforeEach
public void init() {
when(env.getProperty("spring.application.name")).thenReturn("spring-cloud-test");
+ contextRefreshedEvent = new ContextRefreshedEvent(applicationContext);
}
@Test
public void testShenyuBeanProcess() {
registerUtilsMockedStatic.when(() -> RegisterUtils.doLogin(any(),
any(), any())).thenReturn(Optional.of("token"));
// config with full
- SpringCloudClientBeanPostProcessor springCloudClientBeanPostProcessor
= buildSpringCloudClientBeanPostProcessor(true);
- assertThat(springCloudClientTestBean,
equalTo(springCloudClientBeanPostProcessor.postProcessAfterInitialization(springCloudClientTestBean,
"springCloudClientTestBean")));
+ SpringCloudClientBeanListener springCloudClientBeanListener =
buildSpringCloudClientBeanPostProcessor(true);
+
springCloudClientBeanListener.onApplicationEvent(contextRefreshedEvent);
registerUtilsMockedStatic.close();
Review Comment:
missed `assert` judge.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]