Skip to content

Commit 22c8587

Browse files
authored
fix: NPE in BrokersServiceImplTest (#518)
Signed-off-by: tison <wander4096@gmail.com>
1 parent ee83cd2 commit 22c8587

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/test/java/org/apache/pulsar/manager/service/BrokersServiceImplTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ public class BrokersServiceImplTest {
4848
@MockBean
4949
private PulsarAdminService pulsarAdminService;
5050

51+
@MockBean
52+
private EnvironmentCacheService environmentCacheService;
53+
5154
@Autowired
5255
private BrokersService brokersService;
5356

@@ -71,6 +74,9 @@ public void brokersServiceTest() throws Exception{
7174
Mockito.when(brokers.getActiveBrokers("standalone"))
7275
.thenReturn(Arrays.asList("broker-1:8080"));
7376

77+
Mockito.when(environmentCacheService.getEnvironment("http://localhost:8080"))
78+
.thenReturn("env");
79+
7480
Map<String, Object> result = brokersService.getBrokersList(
7581
1, 1, "standalone", "http://localhost:8080");
7682
Assert.assertEquals(1, result.get("total"));

0 commit comments

Comments
 (0)