### Question:
StoreSizeBean extends ManagementBeanProvider { @VisibleForTesting static StoreSizeMBean createBean( ManagementData management, boolean isMxBean, long updateInterval, Clock clock ) { final StoreSizeMBean bean = new StoreSizeMBean( management, isMxBean, updateInterval, clock ); final DataSourceManager dataSourceManager = management.getKernelData().getDataSourceManager(); dataSourceManager.addListener( bean ); return bean; } @SuppressWarnings( "WeakerAccess" ) // Bean needs constructor  StoreSizeBean();   }### Answer:
@Test void shouldCacheValues() throws IOException { final Clock clock = mock( Clock.class ); storeSizeBean = StoreSizeBean.createBean( managementData, false, 100, clock ); when( clock.millis() ).thenReturn( 100L ); createFileOfSize( logFiles.getLogFileForVersion( 0 ), 1 ); createFileOfSize( logFiles.getLogFileForVersion( 1 ), 2 ); Assert.assertEquals( 3L, storeSizeBean.getTransactionLogsSize() ); createFileOfSize( logFiles.getLogFileForVersion( 2 ), 3 ); createFileOfSize( logFiles.getLogFileForVersion( 3 ), 4 ); Assert.assertEquals( 3L, storeSizeBean.getTransactionLogsSize() ); when( clock.millis() ).thenReturn( 200L ); Assert.assertEquals( 10L, storeSizeBean.getTransactionLogsSize() ); }