PropertyConverter { public static List<String> toList(Object value) { if (value instanceof String) { String[] parts = ((String) value).trim().split("\\s*,\\s*"); return Arrays.asList(parts); } else { String msg = formatErrorMessage(value, List.class); log.warn(msg); throw new ConversionException(msg); } } private  PropertyConverter(); static Boolean toBoolean(Object value); static Integer toInteger(Object value); static Long toLong(Object value); static BigInteger toBigInteger(Object value); static List<String> toList(Object value); static Set<String> toSet(Object value);  }
@Test public void testToList() { assertEquals(Arrays.asList("Hello", "world", "how", "are you?"), toList("Hello, world,how, are you?")); }
@Test public void testFailToList() { Throwable t = assertThrows(ConversionException.class, () -> toList(BAD_COMPARISON)); assertEquals(expectedMessage(BAD_COMPARISON, List.class), t.getMessage()); }