@Test public void testExcludeNullViolation() { IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> { filter.exclude("script.name", null); }); assertThat(e.getMessage()).isEqualTo("Violation cannot be null."); }
@Override public boolean exclude(final String scriptName, final Violation violation) { if (scriptName == null) { throw new IllegalArgumentException("Script name cannot be null."); } if (violation == null) { throw new IllegalArgumentException("Violation cannot be null."); } return violationId.equals(violation.getViolationId()); }
ViolationIdFilter implements ViolationFilter { @Override public boolean exclude(final String scriptName, final Violation violation) { if (scriptName == null) { throw new IllegalArgumentException("Script name cannot be null."); } if (violation == null) { throw new IllegalArgumentException("Violation cannot be null."); } return violationId.equals(violation.getViolationId()); } }
ViolationIdFilter implements ViolationFilter { @Override public boolean exclude(final String scriptName, final Violation violation) { if (scriptName == null) { throw new IllegalArgumentException("Script name cannot be null."); } if (violation == null) { throw new IllegalArgumentException("Violation cannot be null."); } return violationId.equals(violation.getViolationId()); } ViolationIdFilter(final ViolationId violationId); }
ViolationIdFilter implements ViolationFilter { @Override public boolean exclude(final String scriptName, final Violation violation) { if (scriptName == null) { throw new IllegalArgumentException("Script name cannot be null."); } if (violation == null) { throw new IllegalArgumentException("Violation cannot be null."); } return violationId.equals(violation.getViolationId()); } ViolationIdFilter(final ViolationId violationId); @Override boolean exclude(final String scriptName, final Violation violation); @Override String toString(); }
ViolationIdFilter implements ViolationFilter { @Override public boolean exclude(final String scriptName, final Violation violation) { if (scriptName == null) { throw new IllegalArgumentException("Script name cannot be null."); } if (violation == null) { throw new IllegalArgumentException("Violation cannot be null."); } return violationId.equals(violation.getViolationId()); } ViolationIdFilter(final ViolationId violationId); @Override boolean exclude(final String scriptName, final Violation violation); @Override String toString();  }