### Question:
StringToLongArrayConverter extends SimpleConverter<String, long[]> { @Override public long[] apply(String source) throws UnconvertibleObjectException { if (source == null) return null; source = source.trim(); if (source.isEmpty()) { return new long[0]; } try { return Pattern.compile("\\s*,\\s*") .splitAsStream(source) .filter(s -> s != null && !s.isEmpty()) .mapToLong(Long::parseLong) .toArray(); } catch (Exception e) { throw new UnconvertibleObjectException("Input string cannot be converted into a long value array", e); } }  @Override Class<String> getSourceClass(); @Override Class<long[]> getTargetClass(); @Override long[] apply(String source);  }### Answer:
@Test public void testConversion() throws UnconvertibleObjectException { final WPSObjectConverter<String, long[]> converter = WPSConverterRegistry.getInstance().getConverter(String.class, long[].class); long[] expected = new long[] {10, 5, 90, 6, 7000000000l}; long[] output = converter.apply("10, 5, 90, 6, 7000000000"); assertArrayEquals(expected, output); output = converter.apply(" "); assertArrayEquals(new long[0], output); try { output = converter.apply("Some random text"); fail("Long parser should not be able to read random text."); } catch (UnconvertibleObjectException ex) { } try { output = converter.apply("10.0, 5.6, 90, 6, 70"); fail("Long parser should not be able to read float values."); } catch (UnconvertibleObjectException ex) { } }