### Question:
ValueMapSerializer { public static String[] serializeToStringArray(Object value) { if (value == null) { return new String[0]; } else if (value instanceof String[]) { return (String[]) value; } else if (value.getClass().isArray()) { List<String> values = (List) Arrays.asList((Object[]) value).stream().map(String::valueOf).collect(Collectors.toList()); return (String[]) values.toArray(new String[0]); } else if (value instanceof Collection) { List<String> values = (List) ((Collection) value).stream().map(String::valueOf).collect(Collectors.toList()); return (String[]) values.toArray(new String[0]); } else { return new String[]{value.toString()}; } } private  ValueMapSerializer(); static void serializeToResource(Resource r, Object sourceObject); static void serializeToMap(Map<String, Object> map, Object sourceObject); static String[] serializeToStringArray(Object value);  }### Answer:
@Test public void testSerializeToStringArray() { Object value = Arrays.asList("one", "two", "three", 4, 5.0D, 6L, Integer.valueOf(7), Long.valueOf(8)); String[] expResult = new String[]{"one", "two", "three", "4", "5.0", "6", "7", "8"}; String[] result = ValueMapSerializer.serializeToStringArray(value); assertArrayEquals(expResult, result); }