### Question:
DefaultPageCacheTracer implements PageCacheTracer { @Override public double usageRatio() { long pages = maxPages.get(); if ( pages == 0 ) { return 0; } return Math.max( 0, (faults.sum() - evictions.sum()) / (double) pages ); }  @Override void mappedFile( File file ); @Override void unmappedFile( File file ); @Override EvictionRunEvent beginPageEvictions( int pageCountToEvict ); @Override MajorFlushEvent beginFileFlush( PageSwapper swapper ); @Override MajorFlushEvent beginCacheFlush(); @Override long faults(); @Override long evictions(); @Override long pins(); @Override long unpins(); @Override long hits(); @Override long flushes(); @Override long bytesRead(); @Override long bytesWritten(); @Override long filesMapped(); @Override long filesUnmapped(); @Override long evictionExceptions(); @Override double hitRatio(); @Override double usageRatio(); @Override void pins( long pins ); @Override void unpins( long unpins ); @Override void hits( long hits ); @Override void faults( long faults ); @Override void bytesRead( long bytesRead ); @Override void evictions( long evictions ); @Override void evictionExceptions( long evictionExceptions ); @Override void bytesWritten( long bytesWritten ); @Override void flushes( long flushes ); @Override void maxPages( long maxPages );  }### Answer:
@Test void usageRatio() { assertThat( tracer.usageRatio(), closeTo( 0d, 0.0001 ) ); tracer.maxPages( 10 ); assertThat( tracer.usageRatio(), closeTo( 0d, 0.0001 ) ); tracer.faults( 5 ); assertThat( tracer.usageRatio(), closeTo( 0.5, 0.0001 ) ); tracer.faults( 5 ); tracer.evictions( 5 ); assertThat( tracer.usageRatio(), closeTo( 0.5, 0.0001 ) ); tracer.faults( 5 ); assertThat( tracer.usageRatio(), closeTo( 1d, 0.0001 ) ); tracer.evictions( 500 ); assertThat( tracer.usageRatio(), closeTo( 0d, 0.0001 ) ); }