### Question:
CommentRenormalizer implements LexicalHandler { @Override public void comment( char[] ch, int start, int length ) throws SAXException { if ( "\n".equals( lineSeparator ) ) { lexicalHandler.comment( ch, start, length ); } else { char[] ca = new String( ch, start, length ).replaceAll( "\n", lineSeparator ).toCharArray(); lexicalHandler.comment( ca, 0, ca.length ); } } CommentRenormalizer( LexicalHandler lexicalHandler );   CommentRenormalizer( LexicalHandler lexicalHandler, String lineSeparator ); @Override void comment( char[] ch, int start, int length ); @Override void startDTD( String name, String publicId, String systemId ); @Override void endDTD(); @Override void startEntity( String name ); @Override void endEntity( String name ); @Override void startCDATA(); @Override void endCDATA();  }### Answer:
@Test public void singleLine() throws Exception { CommentRenormalizer commentRenormalizer = new CommentRenormalizer( lexicalHandler, lineSeparator ); char[] ch = "single line".toCharArray(); commentRenormalizer.comment( ch, 0, ch.length ); verify( lexicalHandler ).comment( ch, 0, ch.length ); }
@Test public void multiLine() throws Exception { CommentRenormalizer commentRenormalizer = new CommentRenormalizer( lexicalHandler, lineSeparator ); String text = "I%sam%sthe%sbest%s"; char[] chIn = String.format( text, "\n", "\n", "\n", "\n" ).toCharArray(); char[] chOut = String.format( text, lineSeparator, lineSeparator, lineSeparator, lineSeparator ).toCharArray(); commentRenormalizer.comment( chIn, 0, chIn.length ); verify( lexicalHandler ).comment( chOut, 0, chOut.length ); }