### Question:
KernelDiagnostics implements DiagnosticsProvider { @Override public void dump( DiagnosticsPhase phase, Logger log ) { if ( phase.isInitialization() || phase.isExplicitlyRequested() ) { dump( log ); } }  @Override String getDiagnosticsIdentifier(); @Override void acceptDiagnosticsVisitor( Object visitor ); @Override void dump( DiagnosticsPhase phase, Logger log );  }### Answer:
@Test public void shouldPrintDiskUsage() { File storeDir = Mockito.spy( new File( "storeDir" ) ); DatabaseLayout layout = mock( DatabaseLayout.class ); when( layout.databaseDirectory() ).thenReturn( storeDir ); when( storeDir.getTotalSpace() ).thenReturn( 100L ); when( storeDir.getFreeSpace() ).thenReturn( 40L ); AssertableLogProvider logProvider = new AssertableLogProvider(); KernelDiagnostics.StoreFiles storeFiles = new KernelDiagnostics.StoreFiles( layout ); storeFiles.dump( logProvider.getLog( getClass() ).debugLogger() ); logProvider.rawMessageMatcher().assertContains( "100 / 40 / 40" ); }
@Test public void shouldCountFileSizeRecursively() throws IOException { File storeDir = directory.directory( "storeDir" ); DatabaseLayout layout = DatabaseLayout.of( storeDir ); File indexDir = directory( storeDir, "indexDir" ); file( indexDir, "indexFile", (int) kibiBytes( 1 ) ); file( storeDir, layout.metadataStore().getName(), (int) kibiBytes( 3 ) ); AssertableLogProvider logProvider = new AssertableLogProvider(); KernelDiagnostics.StoreFiles storeFiles = new KernelDiagnostics.StoreFiles( layout ); storeFiles.dump( logProvider.getLog( getClass() ).debugLogger() ); logProvider.rawMessageMatcher().assertContains( "Total size of store: 4.00 kB" ); logProvider.rawMessageMatcher().assertContains( "Total size of mapped files: 3.00 kB" ); }