### Question:
ValueFilterSplit extends AbstractValueFilterContextual { @Override public ValueObject filter(ValueObject value, Bundle context) { if ((value != null) && (value.getObjectType() == ValueObject.TYPE.ARRAY) && !warnedOnArrayInput) { log.warn("Input value to 'split' ValueFilter is an array: {}. It may not be what you intended.", value); if (ERROR_ON_ARRAY) { throw new IllegalArgumentException("hydra.filter.split.error set to true and tried to split an array"); } warnedOnArrayInput = true; } String string = ValueUtil.asNativeString(value); if ((string == null) || string.isEmpty()) { return null; } String[] token; if (tokenizer != null) { token = tokenizer.tokenize(string).toArray(new String[0]); } else if (fixedLength > 0) { token = splitFixedLength(string, fixedLength); } else if (value.getObjectType() == ValueObject.TYPE.ARRAY && ",".equals(split)) { token = extractArray(value.asArray()); } else { token = LessStrings.splitArray(string, split); } if (keySplit != null) { ValueMap map = ValueFactory.createMap(); for (String v : token) { int pos; if ((pos = v.indexOf(keySplit)) >= 0) { String k = filterKey(v.substring(0, pos), context); if (k == null) { continue; } v = v.substring(pos + keySplit.length()); map.put(k, filterValue(ValueFactory.create(v))); } else { v = filterKey(v, context); if (v == null) { continue; } map.put(v, filterValue(ValueFactory.create(v))); } } return map; } else { ValueArray arr = ValueFactory.createArray(token.length); for (String v : token) { arr.add(filterValue(ValueFactory.create(v))); } return arr; } } @JsonCreator  ValueFilterSplit(@JsonProperty("split") String split,
                                         @JsonProperty("keySplit") String keySplit,
                                         @JsonProperty("filter") ValueFilter filter,
                                         @JsonProperty("keyFilter") ValueFilter keyFilter,
                                         @JsonProperty("fixedLength") int fixedLength,
                                         @JsonProperty("tokenizer") Tokenizer tokenizer); @Override ValueObject filterValue(ValueObject value, Bundle context); @Override ValueObject filter(ValueObject value, Bundle context);  }### Answer:
@Test public void tokenize() throws IOException { ValueFilterSplit vf = Configs.decodeObject(ValueFilterSplit.class, "tokenizer: {group: [\"\\\"\"]} "); assertEquals(getValueArray("foo", "bar"), vf.filter(ValueFactory.create("foo,bar"))); assertEquals(getValueArray("foo,bar", "baz"), vf.filter(ValueFactory.create("\"foo,bar\",baz"))); assertEquals(getValueArray("foo,", "bar"), vf.filter(ValueFactory.create("foo\\,,bar"))); assertEquals(null, vf.filter(ValueFactory.create(""))); }
@Test public void changeCase() throws IOException { ValueArray t1 = getValueArray("foo", "bar"); assertEquals(t1, splitFilter(new ValueFilterJoin().filter(t1), ",", -1)); assertEquals(t1, splitFilter(ValueFactory.create("foo,bar"), ",", -1)); assertEquals(t1, splitFilter(ValueFactory.create("foo | bar"), " | ", -1)); assertEquals(t1, splitFilter(ValueFactory.create("foobar"), null, 3)); }