### Question:
YahooOutputProcessor implements OutputProcessor { @Override public void process(Reader reader, Writer writer) throws IOException { final JavaScriptCompressor javaScriptCompressor = new JavaScriptCompressor(reader, new ErrorReporter() { public void warning(final String message, final String sourceName, final int line, final String lineSource, final int lineOffset) { if (!logWarn) { return; } if (line < 0) { logger.warn("\n[WARNING] " + message); } else { logger.warn("\n[WARNING] " + line + ':' + lineOffset + ':' + message); } } public void error(final String message, final String sourceName, final int line, final String lineSource, final int lineOffset) { if (!logError) { return; } if (line < 0) { logger.error("\n[ERROR] " + message); } else { logger.error("\n[ERROR] " + line + ':' + lineOffset + ':' + message); } } public EvaluatorException runtimeError(final String message, final String sourceName, final int line, final String lineSource, final int lineOffset) { error(message, sourceName, line, lineSource, lineOffset); return new EvaluatorException(message); } }); javaScriptCompressor.compress(writer, linebreakpos, munge, verbose, preserveAllSemiColons, disableOptimizations); }  @Override void process(Reader reader, Writer writer); void setMunge(final boolean munge); void setVerbose(final boolean verbose); void setPreserveAllSemiColons(final boolean preserveAllSemiColons); void setDisableOptimizations(final boolean disableOptimizations); void setLogWarn(final boolean logWarn); void setLogError(final boolean logError); void setLinebreakpos(int linebreakpos);  }### Answer:
@Test public void testSimpleJs() throws Exception { final String js = "function myFunction()\n" + "{\n" + "var x=\"\",i;\n" + "for (i=0;i<5;i++)\n" + " {\n" + " x=x + \"The number is \" + i + \"<br>\";\n" + " }\n" + "document.getElementById(\"demo\").innerHTML=x;\n" + "}"; final StringReader reader = new StringReader(js); final StringWriter writer = new StringWriter(); yahooOutputProcessor.process(reader, writer); final String expected = "function myFunction(){var x=\"\",i;for(i=0;i<5;i++){x=x+\"The number is \"+i+\"<br>\";}document.getElementById(\"demo\").innerHTML=x;}"; final String compiled = writer.getBuffer().toString(); assertEquals(expected, compiled); }