@Test public void classCastExceptionIsThrown_whenMapHasValueOtherThenStrings() { final Map<?, ?> map = ImmutableMap.of("x", "a", "y", new Object()); assertThatExceptionOfType(ClassCastException.class) .isThrownBy(() -> Events.ensureOrderedMapOfStringsToStrings(map)); }
static Map<String, String> ensureOrderedMapOfStringsToStrings(final Map<?, ?> map) { final Map<String, String> result = new LinkedHashMap<>(); map.forEach((key, value) -> result.put((String) key, (String) value)); return result; }
Events { static Map<String, String> ensureOrderedMapOfStringsToStrings(final Map<?, ?> map) { final Map<String, String> result = new LinkedHashMap<>(); map.forEach((key, value) -> result.put((String) key, (String) value)); return result; } }
Events { static Map<String, String> ensureOrderedMapOfStringsToStrings(final Map<?, ?> map) { final Map<String, String> result = new LinkedHashMap<>(); map.forEach((key, value) -> result.put((String) key, (String) value)); return result; }  }
Events { static Map<String, String> ensureOrderedMapOfStringsToStrings(final Map<?, ?> map) { final Map<String, String> result = new LinkedHashMap<>(); map.forEach((key, value) -> result.put((String) key, (String) value)); return result; }   }
Events { static Map<String, String> ensureOrderedMapOfStringsToStrings(final Map<?, ?> map) { final Map<String, String> result = new LinkedHashMap<>(); map.forEach((key, value) -> result.put((String) key, (String) value)); return result; }    }