### Question:
CollectionUtils { public static <T> T getLastElement(List<T> list) { Assert.notEmpty(list); return list.get(list.size() - 1); } private  CollectionUtils(); static T getSingleElement(Iterable<T> iterable); static T getLastElement(List<T> list); static T getSingleElement(Iterable<T> iterable, Supplier<? extends RuntimeException> exceptionSupplier); static T removeAll(T map, Collection<K> keysToRemove);  }### Answer:
@Test void testGetLastElement() throws Exception { assertThat(CollectionUtils.getLastElement(Collections.singletonList(1))).isEqualTo(1); assertThat(CollectionUtils.getLastElement(Arrays.asList(1, 2, 3))).isEqualTo(3); assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> CollectionUtils.getLastElement(Collections.emptyList())) .withMessage("Given collection must not be empty"); }