### Question:
ListValueParser extends ValueParser<List<T>> { @NotNull @Override public List<T> parse(@NotNull final String rawValue) throws ValueParseException { final List<T> parsedValues = new ArrayList<>(); for (final String element : StringUtils.splitPreserveAllTokens(rawValue, delimiter)) { final String trimmedElement = element.trim(); if (StringUtils.isBlank(trimmedElement)) { throw new ValueParseException(rawValue, "List", String.format("Failed to parse list '%s'. The list must be comma separated and each element in the list must not be empty (at least one character that is not whitespace).", rawValue)); } else { parsedValues.add(valueParser.parse(trimmedElement)); } } return parsedValues; } ListValueParser(@NotNull final ValueParser<T> valueParser);  ListValueParser(@NotNull final ValueParser<T> valueParser, @NotNull final String delimiter); @NotNull @Override List<T> parse(@NotNull final String rawValue);  }### Answer:
@Test public void parseDefault() throws ValueParseException { final ListValueParser<String> listValueParser = new TestDefaultListValueParser(new TestValueParser()); final List<String> actualValues = listValueParser.parse("test,this,example , parser"); Assertions.assertEquals(Bds.listOf("test", "this", "example", "parser"), actualValues, "The list parser should be splitting on comma and trimming by default."); }
@Test public void parseCustomDelimiters() throws ValueParseException { final ListValueParser<String> listValueParser = new TestCustomListValueParser(new TestValueParser(), "|"); final List<String> actualValues = listValueParser.parse("test this|parser|for real"); Assertions.assertEquals(Bds.listOf("test this", "parser", "for real"), actualValues); }
@Test public void failsToParseInvalidElement() { final ListValueParser<String> listValueParser = new TestDefaultListValueParser(new TestValueParser()); Assertions.assertThrows(ValueParseException.class, () -> listValueParser.parse("test,should,throw,-1,for,test")); }
@Test public void failsToParseEmpty() { final ListValueParser<String> listValueParser = new TestDefaultListValueParser(new TestValueParser()); Assertions.assertThrows(ValueParseException.class, () -> listValueParser.parse("should,,throw")); }
@Test public void failsToParseWhitespace() { final ListValueParser<String> listValueParser = new TestDefaultListValueParser(new TestValueParser()); Assertions.assertThrows(ValueParseException.class, () -> listValueParser.parse("should, ,throw")); }