@Test public void testIfMessageIsDisplayedOnce() { final ByteArrayOutputStream result = new ByteArrayOutputStream(); final VerboseRegex regex = new VerboseRegex(new RegexCondition("ddd"), new PrintStream(result)); regex.applicable("a"); regex.applicable("b"); MatcherAssert.assertThat( new String(result.toByteArray()), Matchers.is("The following pattern will be used for classes filtering: ddd\n")); }
@Override public final boolean applicable(String identity) { if (say[0]) { this.printer.println( String.format( "The following pattern will be used for classes filtering: %s", this.regexCondition.regex.pattern())); Arrays.fill(say, false); } return this.regexCondition.applicable(identity); }
VerboseRegex implements Condition { @Override public final boolean applicable(String identity) { if (say[0]) { this.printer.println( String.format( "The following pattern will be used for classes filtering: %s", this.regexCondition.regex.pattern())); Arrays.fill(say, false); } return this.regexCondition.applicable(identity); } }
VerboseRegex implements Condition { @Override public final boolean applicable(String identity) { if (say[0]) { this.printer.println( String.format( "The following pattern will be used for classes filtering: %s", this.regexCondition.regex.pattern())); Arrays.fill(say, false); } return this.regexCondition.applicable(identity); } VerboseRegex(RegexCondition condition);   VerboseRegex(RegexCondition regexCondition, PrintStream printer); }
VerboseRegex implements Condition { @Override public final boolean applicable(String identity) { if (say[0]) { this.printer.println( String.format( "The following pattern will be used for classes filtering: %s", this.regexCondition.regex.pattern())); Arrays.fill(say, false); } return this.regexCondition.applicable(identity); } VerboseRegex(RegexCondition condition);   VerboseRegex(RegexCondition regexCondition, PrintStream printer); @Override final boolean applicable(String identity); }
VerboseRegex implements Condition { @Override public final boolean applicable(String identity) { if (say[0]) { this.printer.println( String.format( "The following pattern will be used for classes filtering: %s", this.regexCondition.regex.pattern())); Arrays.fill(say, false); } return this.regexCondition.applicable(identity); } VerboseRegex(RegexCondition condition);   VerboseRegex(RegexCondition regexCondition, PrintStream printer); @Override final boolean applicable(String identity);  }