### Question:
CollectionUtils { public static <K, I, M, E extends Exception> Map<K, M> transformMap(final Map<K, I> map, final Function<I, M, E> mapper) throws E { Reject.ifNull(map, mapper); final Map<K, M> newMap = new HashMap<K, M>(map.size()); for (Map.Entry<K, I> entry : map.entrySet()) { newMap.put(entry.getKey(), mapper.apply(entry.getValue())); } return newMap; } private  CollectionUtils(); static Set<String> removeBlankEntries(Set<String> originalSet); static List<T> asList(T... values); static Set asCaseInsensitiveHashSet(Object... values); static Set<T> asSet(T... values); static LinkedHashSet<T> asOrderedSet(T... values); static Map<V, K> invertMap(final Map<K, V> map); static Map<K, M> transformMap(final Map<K, I> map,
                                                                        final Function<I, M, E> mapper); static List<M> transformList(final Collection<I> values,
                                                                    final Function<I, M, E> mapper); static Set<M> transformSet(final Collection<I> values,
                                                                  final Function<I, M, E> mapper); static T getFirstItem(final Collection<T> collection); static T getFirstItem(final Collection<T> collection, final T defaultValue); static boolean genericCompare(T valA, T valB); static boolean compareCaseInsensitiveMapOfSetOfStrings(Map<String, Set<String>> valA,
            Map<String, Set<String>> valB); static int createHashForCaseInsensitiveMapOfSetOfStrings(Map<String, Set<String>> map); static boolean isNotEmpty(final Collection<?> collection); static boolean isEmpty(Collection<?> collection); static Map<String, Set<String>> toAvPairMap(final Set<String> names, final String value); static boolean isEmpty(Map<?, ?> map); static boolean isNotEmpty(Map<?, ?> map); static boolean anyHaveEntries(Object... containers); static Map<K, V> sortMapByValue(Map<K, V> map);  }### Answer:
@Test public void mapStringToIntWithinMap() { Map<String, String> mapOfString = new HashMap<String, String>(); mapOfString.put("value1", "12"); mapOfString.put("value2", "34"); mapOfString.put("value3", "56"); mapOfString.put("value4", "78"); mapOfString.put("value5", "90"); Map<String, Integer> mapOfInt = CollectionUtils.transformMap(mapOfString, new MapStringToInt()); assertThat(mapOfInt.size()).isEqualTo(5); assertThat(mapOfInt.get("value1")).isNotNull().isEqualTo(12); assertThat(mapOfInt.get("value2")).isNotNull().isEqualTo(34); assertThat(mapOfInt.get("value3")).isNotNull().isEqualTo(56); assertThat(mapOfInt.get("value4")).isNotNull().isEqualTo(78); assertThat(mapOfInt.get("value5")).isNotNull().isEqualTo(90); }
@Test(expectedExceptions = SomeCheckedException.class) public void mappingFailsWithinMap() throws SomeCheckedException { Map<String, String> someMap = new HashMap<String, String>(); someMap.put("test", "data"); CollectionUtils.transformMap(someMap, new FailMapping()); }