### Question:
StdoutOutputGenerator extends OutputGenerator<String> { @Override public String generate() { OutputFilter outputFilter = new OutputFilter(options); outputFilter.filter(jApiClasses); StringBuilder sb = new StringBuilder(); sb.append(options.getDifferenceDescription()).append('\n'); if (options.getIgnoreMissingClasses().isIgnoreAllMissingClasses()) { sb.append(WARNING).append(": You are using the option '").append(CliParser.IGNORE_MISSING_CLASSES) .append("', i.e. superclasses and interfaces that could not be found on the classpath are ignored.") .append(" Hence changes caused by these superclasses and interfaces are not reflected in the output.\n"); } else if (options.getIgnoreMissingClasses().getIgnoreMissingClassRegularExpression().size() > 0) { sb.append(WARNING).append(": You have ignored certain classes, i.e. superclasses and interfaces that could not ") .append("be found on the classpath are ignored. Hence changes caused by these superclasses and interfaces are not reflected in the output.\n"); } if (jApiClasses.size() > 0) { for (JApiClass jApiClass : jApiClasses) { processClass(sb, jApiClass); processConstructors(sb, jApiClass); processMethods(sb, jApiClass); processAnnotations(sb, jApiClass, 1); } } else { sb.append(NO_CHANGES); } return sb.toString(); } StdoutOutputGenerator(Options options, List<JApiClass> jApiClasses); @Override String generate();  }### Answer:
@Test public void testNoChanges() { Options options = Options.newDefault(); StdoutOutputGenerator generator = new StdoutOutputGenerator(options, new ArrayList<JApiClass>(0)); String generated = generator.generate(); assertThat(generated, containsString(StdoutOutputGenerator.NO_CHANGES)); }
@Test public void testWarningWhenIgnoreMissingClasses() { Options options = Options.newDefault(); options.setIgnoreMissingClasses(true); StdoutOutputGenerator generator = new StdoutOutputGenerator(options, new ArrayList<JApiClass>(0)); String generated = generator.generate(); assertThat(generated, containsString(StdoutOutputGenerator.WARNING)); assertThat(generated, containsString(CliParser.IGNORE_MISSING_CLASSES)); }
@Test public void testNoClassFileFormatVersionIfInterfaceRemoved() throws Exception { JarArchiveComparatorOptions jarArchiveComparatorOptions = new JarArchiveComparatorOptions(); jarArchiveComparatorOptions.setAccessModifier(AccessModifier.PRIVATE); List<JApiClass> jApiClasses = ClassesHelper.compareClasses(jarArchiveComparatorOptions, new ClassesHelper.ClassesGenerator() { @Override public List<CtClass> createOldClasses(ClassPool classPool) throws Exception { CtClass myInterface = CtInterfaceBuilder.create().name("MyInterface").addToClassPool(classPool); return Collections.singletonList(myInterface); } @Override public List<CtClass> createNewClasses(ClassPool classPool) throws Exception { return Collections.emptyList(); } }); Options options = Options.newDefault(); StdoutOutputGenerator generator = new StdoutOutputGenerator(options, jApiClasses); String generated = generator.generate(); assertThat(generated, not(containsString("-1.-1"))); }