ConsoleLogging implements Logging { @Override public Logger getLog( String name ) { return new ConsoleLogger( name, level ); } ConsoleLogging( Level level ); @Override Logger getLog( String name );  }
@Test void shouldOnlyRecordMessageOnce() { ConsoleLogging logging = new ConsoleLogging( Level.ALL ); Logger catLogger = logging.getLog( "Cat" ); Logger dogLogger = logging.getLog( "Dog" ); catLogger.debug( "Meow" ); dogLogger.debug( "Wow" ); Scanner scanner = new Scanner( new ByteArrayInputStream( out.toByteArray() ) ); assertTrue( scanner.hasNextLine() ); assertTrue( scanner.nextLine().contains( "Meow" ) ); assertTrue( scanner.hasNextLine() ); assertTrue( scanner.nextLine().contains( "Wow" ) ); assertFalse( scanner.hasNextLine() ); }