### Question:
ValueFilterJSON extends AbstractValueFilter { @Nullable @Override public ValueObject filterValue(@Nullable ValueObject value) { try { if (value == null) { return null; } else { return ValueFactory.decodeValue(value.asString().asNative()); } } catch (IOException ex) { throw new UncheckedIOException(ex); } }  @Nullable @Override ValueObject filterValue(@Nullable ValueObject value);  }### Answer:
@Test public void parseNull() throws IOException { assertEquals(null, json.filterValue(null)); roundTrip(null); }
@Test public void parseString() throws IOException { assertEquals(ValueFactory.create(""), json.filterValue(ValueFactory.create("\"\""))); assertEquals(ValueFactory.create("foo"), json.filterValue(ValueFactory.create("\"foo\""))); assertEquals(ValueFactory.create("foo\"bar"), json.filterValue(ValueFactory.create("\"foo\\\"bar\""))); assertEquals(ValueFactory.create("foo\\bar"), json.filterValue(ValueFactory.create("\"foo\\\\bar\""))); assertEquals(ValueFactory.create("foo,bar"), json.filterValue(ValueFactory.create("\"foo,bar\""))); roundTrip(ValueFactory.create("")); roundTrip(ValueFactory.create("foo")); roundTrip(ValueFactory.create("foo\"bar")); roundTrip(ValueFactory.create("foo\\bar")); roundTrip(ValueFactory.create("foo,bar")); }
@Test public void parseArray() throws IOException { ValueArray array = ValueFactory.createArray(3); assertEquals(array, json.filterValue(ValueFactory.create("[]"))); roundTrip(array); array.add(ValueFactory.create(1)); array.add(ValueFactory.create(2)); array.add(ValueFactory.create(3)); assertEquals(array, json.filterValue(ValueFactory.create("[1,2,3]"))); roundTrip(array); array.clear(); array.add(ValueFactory.create("foo")); array.add(ValueFactory.create("bar")); array.add(ValueFactory.create("baz\"quux")); assertEquals(array, json.filterValue(ValueFactory.create("[\"foo\",\"bar\",\"baz\\\"quux\"]"))); roundTrip(array); }
@Test public void parseMap() throws IOException { ValueMap map = ValueFactory.createMap(); assertEquals(map, json.filterValue(ValueFactory.create("{}"))); roundTrip(map); map.put("foo", ValueFactory.create(1)); map.put("bar", ValueFactory.create("baz\"quux")); assertEquals(map, json.filterValue(ValueFactory.create("{\"foo\":1,\"bar\":\"baz\\\"quux\"}"))); roundTrip(map); }