@Test public void classCastExceptionIsThrown_whenListOfObjectsContainsSomethingDifferentThanString() { final List<?> list = newArrayList("a", new Object(), "c"); assertThatExceptionOfType(ClassCastException.class).isThrownBy(() -> Events.ensureListOfStrings(list)); }
static List<String> ensureListOfStrings(final List<?> list) { return list.stream().map(String.class::cast).collect(toList()); }
Events { static List<String> ensureListOfStrings(final List<?> list) { return list.stream().map(String.class::cast).collect(toList()); } }
Events { static List<String> ensureListOfStrings(final List<?> list) { return list.stream().map(String.class::cast).collect(toList()); }  }
Events { static List<String> ensureListOfStrings(final List<?> list) { return list.stream().map(String.class::cast).collect(toList()); }   }
Events { static List<String> ensureListOfStrings(final List<?> list) { return list.stream().map(String.class::cast).collect(toList()); }    }