diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/BookKeeperClientFactoryImplTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/BookKeeperClientFactoryImplTest.java index 51273b58eb869..a02689dc9763a 100644 --- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/BookKeeperClientFactoryImplTest.java +++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/BookKeeperClientFactoryImplTest.java @@ -300,23 +300,25 @@ public void testBookKeeperIoThreadsConfiguration() throws Exception { } @Test - public void testBookKeeperLimitStatsLoggingConfiguration() { + public void testBookKeeperLimitStatsLoggingConfiguration() throws Exception { BookKeeperClientFactoryImpl factory = new BookKeeperClientFactoryImpl(); ServiceConfiguration conf = new ServiceConfiguration(); - assertEquals(factory.createBkClientConfiguration(mock(MetadataStoreExtended.class), conf) - .getLimitStatsLogging(), false); + assertFalse( + factory.createBkClientConfiguration(mock(MetadataStoreExtended.class), conf).getLimitStatsLogging()); EventLoopGroup eventLoopGroup = mock(EventLoopGroup.class); BookKeeper.Builder builder = factory.getBookKeeperBuilder(conf, eventLoopGroup, mock(StatsLogger.class), factory.createBkClientConfiguration(mock(MetadataStoreExtended.class), conf)); - ClientConfiguration clientConfiguration = Whitebox.getInternalState(builder, "conf"); - assertEquals(clientConfiguration.getLimitStatsLogging(), false); + ClientConfiguration clientConfiguration = + (ClientConfiguration) FieldUtils.readField(builder, "conf", true); + assertFalse(clientConfiguration.getLimitStatsLogging()); conf.setBookkeeperClientLimitStatsLogging(true); - assertEquals(factory.createBkClientConfiguration(mock(MetadataStoreExtended.class), conf) - .getLimitStatsLogging(), true); + assertTrue(factory.createBkClientConfiguration(mock(MetadataStoreExtended.class), conf) + .getLimitStatsLogging()); builder = factory.getBookKeeperBuilder(conf, eventLoopGroup, mock(StatsLogger.class), factory.createBkClientConfiguration(mock(MetadataStoreExtended.class), conf)); - clientConfiguration = Whitebox.getInternalState(builder, "conf"); - assertEquals(clientConfiguration.getLimitStatsLogging(), true); + clientConfiguration = + (ClientConfiguration) FieldUtils.readField(builder, "conf", true); + assertTrue(clientConfiguration.getLimitStatsLogging()); } }