LevelFilter extends AbstractLogFilter { @Override public boolean accept(LogData logData, int row) { if (logData.getLevel() == null) { return true; } switch (filterMode) { case LOWER_OR_EQUAL: return logData.getLevel().intValue() <= passLevel; case EQUAL: return logData.getLevel().intValue() == passLevel; case HIGHER_OR_EQUAL: return logData.getLevel().intValue() >= passLevel; default: return false; } } LevelFilter(); void setPassLevel(int passLevel); @Override boolean accept(LogData logData, int row); @Override Component getGUI();  }
@Test public void testAccept() { LogData ld = new LogData(); ld.setLevel(Level.FINEST); LevelFilter filter = new LevelFilter(); filter.init(new Properties(), new LogDataTableModel(), mock(Theme.class)); filter.setPassLevel(Level.ALL.intValue()); assertTrue(filter.accept(ld, 0)); filter.setPassLevel(Level.FINEST.intValue()); assertTrue(filter.accept(ld, 0)); filter.setPassLevel(Level.FINER.intValue()); assertFalse(filter.accept(ld, 0)); filter.setPassLevel(Level.INFO.intValue()); assertFalse(filter.accept(ld, 0)); ld.setLevel(Level.INFO); assertTrue(filter.accept(ld, 0)); ld.setLevel(Level.SEVERE); assertTrue(filter.accept(ld, 0)); filter.setPassLevel(Level.WARNING.intValue()); assertTrue(filter.accept(ld, 0)); }