You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As com.google.api.client.json.jackson2.JacksonFactory does not provide API to configure the parser, I had to implement my own JacksonFactory and JacksonParser for my POC above (NonstrictJacksonFactory and MyJacksonParser).
Describe the solution you'd like
In my test cases, I want to write JSON key without double-quotes and strings in JSON with single quotes. I wish JacksonFactory allows me to set the following options:
I was trying to enhance Apache Beam's test cases that relies on toString() of objects. suztomo/beam@314b74b . I came up with my assertEqualsOnJson method but still do not like the escaped double quotes in test assertions.
The text was updated successfully, but these errors were encountered:
Can
com.google.api.client.json.jackson2.JacksonFactory
have methods to configure the parser?Is your feature request related to a problem? Please describe.
I'm always frustrated when I write escaped double quotes in Java String literal, especially when writing test cases for JSON.
Concrete example: suztomo/beam@74e9335#diff-d2f80ee068a253407b9347a92b0f49a5L119
As
com.google.api.client.json.jackson2.JacksonFactory
does not provide API to configure the parser, I had to implement my ownJacksonFactory
andJacksonParser
for my POC above (NonstrictJacksonFactory
andMyJacksonParser
).Describe the solution you'd like
In my test cases, I want to write JSON key without double-quotes and strings in JSON with single quotes. I wish JacksonFactory allows me to set the following options:
With these configuration, the example JSON text above can be written as:
This is much easier to read compared to previous example of many escape characters.
Describe alternatives you've considered
Write test case with double-quotes escaped:
Write test case with
ImmutableMap.of
:(Thanks @BenWhitehead !)
Additional context
I was trying to enhance Apache Beam's test cases that relies on
toString()
of objects.suztomo/beam@314b74b . I came up with my
assertEqualsOnJson
method but still do not like the escaped double quotes in test assertions.The text was updated successfully, but these errors were encountered: