### Question:
MapUtils { @SuppressWarnings("unchecked") static String[] getStringArray(Map<String, Object> map, String key) { Object value = map.get(key); if (value instanceof List) return toStringArray((List<Object>) value); else if (!value.getClass().isArray()) return new String[]{value.toString()}; else if (value.getClass().getComponentType() == String.class) return (String[]) value; else throw createBadTypeException(key, value, "an array of strings"); }  static boolean isNullOrEmptyString(String s);  }### Answer:
@Test public void whenStringArrayValueIsStringArray_returnAsIs() throws Exception { Map<String,Object> map = ImmutableMap.of("values", STRING_ARRAY); assertThat(MapUtils.getStringArray(map, "values"), arrayContaining(STRING_ARRAY)); }
@Test public void whenStringArrayValueIsSingleObject_returnAsLengthOneArray() throws Exception { Map<String,Object> map = ImmutableMap.of("values", 33); assertThat(MapUtils.getStringArray(map, "values"), arrayContaining("33")); }
@Test public void whenStringArrayValueIsList_returnAsArray() throws Exception { Map<String,Object> map = ImmutableMap.of("values", Arrays.asList(7, 8, true)); assertThat(MapUtils.getStringArray(map, "values"), arrayContaining("7", "8", "true")); }