JulMappings { static Level findFirst(LevelMapping[] mappings, IntPredicate predicate) { for (LevelMapping mapping : mappings) { if (predicate.test(mapping.zlgLevel)) { return mapping.julLevel; } } throw new IllegalStateException("No matching level found"); } private  JulMappings();   }
@Test public void testFindFirst() { final Level first = JulMappings.findFirst(buildTestMappings(), level -> level == LogLevel.WARN); assertEquals(Level.WARNING, first); }
@Test(expected=IllegalStateException.class) public void testFindFirstNonExistant() { JulMappings.findFirst(buildTestMappings(), level -> level == LogLevel.OFF); }