Source:
public final void testExecuteIgnoredModules() throws IOException { final CheckstyleAntTask antTask = getCheckstyleAntTask(); antTask.setFile(new File(getPath(VIOLATED_INPUT))); antTask.setFailOnViolation(false); antTask.setExecuteIgnoredModules(true); final CheckstyleAntTask.Formatter formatter = new CheckstyleAntTask.Formatter(); final File outputFile = new File("target/ant_task_plain_output.txt"); formatter.setTofile(outputFile); final CheckstyleAntTask.FormatterType formatterType = new CheckstyleAntTask.FormatterType(); formatterType.setValue("plain"); formatter.setType(formatterType); formatter.createListener(null); final LocalizedMessage auditStartedMessage = new LocalizedMessage(0, Definitions.CHECKSTYLE_BUNDLE, "DefaultLogger.auditStarted", null, null, getClass(), null); final LocalizedMessage auditFinishedMessage = new LocalizedMessage(0, Definitions.CHECKSTYLE_BUNDLE, "DefaultLogger.auditFinished", null, null, getClass(), null); antTask.addFormatter(formatter); antTask.execute(); final List<String> output = FileUtils.readLines(outputFile); final String errorMessage = "Content of file with violations differs from expected"; assertEquals(errorMessage, auditStartedMessage.getMessage(), output.get(0)); assertTrue(errorMessage, output.get(1).startsWith("[WARN]")); assertTrue(errorMessage, output.get(1).endsWith("InputCheckstyleAntTaskError.java:4: " + "@incomplete=Some javadoc [WriteTag]")); assertTrue(errorMessage, output.get(2).startsWith("[ERROR]")); assertTrue(errorMessage, output.get(2).endsWith("InputCheckstyleAntTaskError.java:7: " + "Line is longer than 70 characters (found 80). [LineLength]")); assertTrue(errorMessage, output.get(3).startsWith("[ERROR]")); assertTrue(errorMessage, output.get(3).endsWith("InputCheckstyleAntTaskError.java:9: " + "Line is longer than 70 characters (found 81). [LineLength]")); assertEquals(errorMessage, auditFinishedMessage.getMessage(), output.get(4)); }

Target:
public final void testExecuteIgnoredModules() throws IOException { final CheckstyleAntTask antTask = getCheckstyleAntTask(); antTask.setFile(new File(getPath(VIOLATED_INPUT))); antTask.setFailOnViolation(false); antTask.setExecuteIgnoredModules(true); final CheckstyleAntTask.Formatter formatter = new CheckstyleAntTask.Formatter(); final File outputFile = new File("target/ant_task_plain_output.txt"); formatter.setTofile(outputFile); final CheckstyleAntTask.FormatterType formatterType = new CheckstyleAntTask.FormatterType(); formatterType.setValue("plain"); formatter.setType(formatterType); formatter.createListener(null); antTask.addFormatter(formatter); antTask.execute(); final LocalizedMessage auditStartedMessage = new LocalizedMessage(0, Definitions.CHECKSTYLE_BUNDLE, "DefaultLogger.auditStarted", null, null, getClass(), null); final LocalizedMessage auditFinishedMessage = new LocalizedMessage(0, Definitions.CHECKSTYLE_BUNDLE, "DefaultLogger.auditFinished", null, null, getClass(), null); final List<String> output = FileUtils.readLines(outputFile); final String errorMessage = "Content of file with violations differs from expected"; assertEquals(errorMessage, auditStartedMessage.getMessage(), output.get(0)); assertTrue(errorMessage, output.get(1).startsWith("[WARN]")); assertTrue(errorMessage, output.get(1).endsWith("InputCheckstyleAntTaskError.java:4: " + "@incomplete=Some javadoc [WriteTag]")); assertTrue(errorMessage, output.get(2).startsWith("[ERROR]")); assertTrue(errorMessage, output.get(2).endsWith("InputCheckstyleAntTaskError.java:7: " + "Line is longer than 70 characters (found 80). [LineLength]")); assertTrue(errorMessage, output.get(3).startsWith("[ERROR]")); assertTrue(errorMessage, output.get(3).endsWith("InputCheckstyleAntTaskError.java:9: " + "Line is longer than 70 characters (found 81). [LineLength]")); assertEquals(errorMessage, auditFinishedMessage.getMessage(), output.get(4)); }