@Test
public void testOnKey() {

    final AtomicReference<String> latch = new AtomicReference<>("");
    final Map<String, Integer> refMap = new LinkedHashMap<>();
    refMap.put("one", 1);
    refMap.put("two", 2);
    refMap.put("three", 3);
    refMap.entrySet().forEach(onKey(string -> latch.accumulateAndGet(string, String::concat)));
    assertTrue("onKey latch should contain 'one'", latch.get().contains("one"));
    assertTrue("onKey latch should contain 'two'", latch.get().contains("two"));
    assertTrue("onKey latch should contain 'three'", latch.get().contains("three"));
}