@Test public void testExcludeNullLineNumber() { final Violation violation = mock(Violation.class); when(violation.getLineNumber()).thenReturn(null); assertThat(filter.exclude("a.script", violation)).isFalse(); }
@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."); } if (violation.getLineNumber() == null) { LOGGER.warn( "An exclusion of line number {} was set, but violation {} has no line number information available.", Integer.valueOf(lineNumber), violation); return false; } return lineNumber == violation.getLineNumber().intValue(); }
LineNumberFilter 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."); } if (violation.getLineNumber() == null) { LOGGER.warn( "An exclusion of line number {} was set, but violation {} has no line number information available.", Integer.valueOf(lineNumber), violation); return false; } return lineNumber == violation.getLineNumber().intValue(); } }
LineNumberFilter 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."); } if (violation.getLineNumber() == null) { LOGGER.warn( "An exclusion of line number {} was set, but violation {} has no line number information available.", Integer.valueOf(lineNumber), violation); return false; } return lineNumber == violation.getLineNumber().intValue(); } LineNumberFilter(final int lineNumber); }
LineNumberFilter 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."); } if (violation.getLineNumber() == null) { LOGGER.warn( "An exclusion of line number {} was set, but violation {} has no line number information available.", Integer.valueOf(lineNumber), violation); return false; } return lineNumber == violation.getLineNumber().intValue(); } LineNumberFilter(final int lineNumber); @Override boolean exclude(final String scriptName, final Violation violation); @Override String toString(); }
LineNumberFilter 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."); } if (violation.getLineNumber() == null) { LOGGER.warn( "An exclusion of line number {} was set, but violation {} has no line number information available.", Integer.valueOf(lineNumber), violation); return false; } return lineNumber == violation.getLineNumber().intValue(); } LineNumberFilter(final int lineNumber); @Override boolean exclude(final String scriptName, final Violation violation); @Override String toString();  }