Skip to content

Commit

Permalink
Minor test improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Feb 16, 2024
1 parent 0245c57 commit 8d5be9e
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ public ValueWriter modifyValueWriter(JSONWriter writeContext,
}
}

static class Name {
public String first, last;

public Name(String f, String l) {
first = f;
last = l;
}
}

/*
/**********************************************************************
/* Tests for wholesale replacement of `ValueReader`
Expand All @@ -96,10 +105,15 @@ public Class<?> valueType() {
}
});
final String input = "foobar";
String result = jsonWithModifier(mod).asString(input);
final JSON jsonWithMod = jsonWithModifier(mod);
String result = jsonWithMod.asString(input);
assertEquals(quote("FOOBAR"), result);
// but also verify that no caching occurs wrt global standard variant:
assertEquals(quote("foobar"), JSON.std.asString(input));

// And then also applicable for multiple POJO properties
assertEquals(a2q("{'first':'Bob','last':'Hope'}"),
jsonWithMod.asString(new Name("Bob", "Hope")));
}

public void testPOJOWriterReplacement() throws Exception
Expand Down

0 comments on commit 8d5be9e

Please sign in to comment.