What about using JSONassert or hamcrest-json or some other JSON matcher
library?

On Thu, Dec 19, 2019 at 1:17 PM Tomo Suzuki <[email protected]> wrote:

> Hi Beam developers,
>
> There are many Java tests relying on toString() methods for assertions
> [1]. This style is prone to unnecessary maintenance of the test code
> when upgrading dependencies. For example, BEAM-8695 encountered ~10
> comparison failures due to change in toString implementation when I
> tried to upgrade google-http-client [2].
>
> On the other hand, constructing expected objects is cumbersome and
> less readable [3].
>
> Therefore, I'm thinking a better way to write assertions on subclasses
> of GenericJson in BEAM-9000 "Java Test Assertions without toString for
> GenericJson subclasses." So far, I wrote 2 options there:
> - Assertion using Map
> - Create assertEqualsOnJson
>
> If you think of a better way or opinions on how these tests should be,
> please let me know.
>
>
> [1]:
> https://github.com/suztomo/beam/commit/314b74b127c1dce9d8de9485aeb31321be8e13c8#r36506354
> [2]:
> https://issues.apache.org/jira/browse/BEAM-8695?focusedCommentId=16999527&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-16999527
> [3]:
> https://github.com/suztomo/beam/commit/314b74b127c1dce9d8de9485aeb31321be8e13c8#r36509217
>
> --
> Regards,
> Tomo
>

Reply via email to