void () { for (Level level : new Level[]{Level.SEVERE, Level.WARNING}) { Map<Level, List<Pair<String, Throwable>>> diags = new ConcurrentHashMap<>(); Throwable t = new Throwable(level.toString()); Logger logger = getDelegate(diags); log(logger, level, null, t); log(logger, level, null, t); assertEquals("Too many " + level + " posted: " + diags, 1, diags.size()); assertEquals("Too many " + level + " posted: " + diags, 1, diags.get(level).size()); Pair<String, Throwable> first = diags.get(level).get(0); assertSame("Second error doesn't contain throwable: " + first, t, first.second); } }