### Question:
MinijarFilter implements Filter { public void finished() { int classesTotal = classesRemoved + classesKept; if ( classesTotal != 0 ) { log.info( "Minimized " + classesTotal + " -> " + classesKept + " (" + 100 * classesKept / classesTotal + "%)" ); } else { log.info( "Minimized " + classesTotal + " -> " + classesKept ); } } MinijarFilter( int classesKept, int classesRemoved, Log log );  MinijarFilter( MavenProject project, Log log );  MinijarFilter( MavenProject project, Log log, List<SimpleFilter> simpleFilters ); boolean canFilter( File jar ); boolean isFiltered( String classFile ); void finished();  }### Answer:
@Test public void testWithMockProject() throws IOException { ArgumentCaptor<CharSequence> logCaptor = ArgumentCaptor.forClass( CharSequence.class ); MavenProject mavenProject = mockProject(emptyFile); Log log = mock( Log.class ); MinijarFilter mf = new MinijarFilter( mavenProject, log ); mf.finished(); verify( log, times( 1 ) ).info( logCaptor.capture() ); assertEquals( "Minimized 0 -> 0", logCaptor.getValue() ); }
@Test public void testWithPomProject() throws IOException { ArgumentCaptor<CharSequence> logCaptor = ArgumentCaptor.forClass( CharSequence.class ); MavenProject mavenProject = mockProject(null); mavenProject.setPackaging("pom"); Log log = mock( Log.class ); MinijarFilter mf = new MinijarFilter( mavenProject, log ); mf.finished(); verify( log, times( 1 ) ).info( logCaptor.capture() ); verify( mavenProject, times(0) ).getArtifacts(); assertEquals( "Minimized 0 -> 0", logCaptor.getValue() ); }
@Test public void finsishedShouldProduceMessageForClassesTotalNonZero() { ArgumentCaptor<CharSequence> logCaptor = ArgumentCaptor.forClass( CharSequence.class ); Log log = mock( Log.class ); MinijarFilter m = new MinijarFilter( 1, 50, log ); m.finished(); verify( log, times( 1 ) ).info( logCaptor.capture() ); assertEquals( "Minimized 51 -> 1 (1%)", logCaptor.getValue() ); }
@Test public void finsishedShouldProduceMessageForClassesTotalZero() { ArgumentCaptor<CharSequence> logCaptor = ArgumentCaptor.forClass( CharSequence.class ); Log log = mock( Log.class ); MinijarFilter m = new MinijarFilter( 0, 0, log ); m.finished(); verify( log, times( 1 ) ).info( logCaptor.capture() ); assertEquals( "Minimized 0 -> 0", logCaptor.getValue() ); }