This is an automated email from the ASF dual-hosted git repository. xiangying pushed a commit to branch branch-0.5.0 in repository https://gitbox.apache.org/repos/asf/pulsar-manager.git
commit 14ae44cb04436ccec17949a44610fc73afef9f30 Author: tison <wander4...@gmail.com> AuthorDate: Fri Jun 2 11:06:18 2023 +0800 fix: NPE in BrokersServiceImplTest (#518) Signed-off-by: tison <wander4...@gmail.com> (cherry picked from commit 22c8587e641ca524f4edda9ba8444aa5ff494da2) --- .../org/apache/pulsar/manager/service/BrokersServiceImplTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/test/java/org/apache/pulsar/manager/service/BrokersServiceImplTest.java b/src/test/java/org/apache/pulsar/manager/service/BrokersServiceImplTest.java index 6139fc3..b3ce053 100644 --- a/src/test/java/org/apache/pulsar/manager/service/BrokersServiceImplTest.java +++ b/src/test/java/org/apache/pulsar/manager/service/BrokersServiceImplTest.java @@ -48,6 +48,9 @@ public class BrokersServiceImplTest { @MockBean private PulsarAdminService pulsarAdminService; + @MockBean + private EnvironmentCacheService environmentCacheService; + @Autowired private BrokersService brokersService; @@ -71,6 +74,9 @@ public class BrokersServiceImplTest { Mockito.when(brokers.getActiveBrokers("standalone")) .thenReturn(Arrays.asList("broker-1:8080")); + Mockito.when(environmentCacheService.getEnvironment("http://localhost:8080")) + .thenReturn("env"); + Map<String, Object> result = brokersService.getBrokersList( 1, 1, "standalone", "http://localhost:8080"); Assert.assertEquals(1, result.get("total"));