LevelScanner extends SingleEntryIncrementalMatcher { @Override public Event matches(final LogEntry entry) { if (entry.getSeverity() != null && comparator.matches(severityNumber, entry.getSeverity())) { final Event event = new Event(); return event; } return null; }  @Override Event matches(final LogEntry entry); LevelComparatorType getComparator(); void setComparator(final LevelComparatorType comparator); int getSeverityNumber(); void setSeverityNumber(final int severityNumber); @Override LinkedHashMap<String, FieldBaseTypes> getFieldTypes();  }
@Test public void testComparators() { Assert.assertEquals(true, EQ.matches(1, new SeverityLevel(null, 1, null))); Assert.assertEquals(false, EQ.matches(2, new SeverityLevel(null, 1, null))); Assert.assertEquals(false, EQ.matches(0, new SeverityLevel(null, 1, null))); Assert.assertEquals(false, NEQ.matches(1, new SeverityLevel(null, 1, null))); Assert.assertEquals(true, NEQ.matches(2, new SeverityLevel(null, 1, null))); Assert.assertEquals(true, NEQ.matches(0, new SeverityLevel(null, 1, null))); Assert.assertEquals(true, EQ_OR_LESS.matches(1, new SeverityLevel(null, 1, null))); Assert.assertEquals(true, EQ_OR_LESS.matches(2, new SeverityLevel(null, 1, null))); Assert.assertEquals(false, EQ_OR_LESS.matches(0, new SeverityLevel(null, 1, null))); Assert.assertEquals(false, LESS.matches(1, new SeverityLevel(null, 1, null))); Assert.assertEquals(true, LESS.matches(2, new SeverityLevel(null, 1, null))); Assert.assertEquals(false, LESS.matches(0, new SeverityLevel(null, 1, null))); Assert.assertEquals(false, GREATER.matches(1, new SeverityLevel(null, 1, null))); Assert.assertEquals(false, GREATER.matches(2, new SeverityLevel(null, 1, null))); Assert.assertEquals(true, GREATER.matches(0, new SeverityLevel(null, 1, null))); Assert.assertEquals(true, EQ_OR_GREATER.matches(1, new SeverityLevel(null, 1, null))); Assert.assertEquals(false, EQ_OR_GREATER.matches(2, new SeverityLevel(null, 1, null))); Assert.assertEquals(true, EQ_OR_GREATER.matches(0, new SeverityLevel(null, 1, null))); }