Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not very useful output when comparing Jackson JsonNode objects #264

Open
cloudshiftchris opened this issue Apr 13, 2022 · 1 comment
Open

Comments

@cloudshiftchris
Copy link

Comparing Jackson JsonNode objects is useful more matching up JSON, sidestepping formatting and key-order considerations.

When doing expectThat(actualNode).isEqualTo(expectedNode) the comparison works as expected, however the failure output (when the nodes do not match) doesn't properly show the toString() of the nodes.

▼ Expect that [CdkResource(name=SecureBucket1ED1C5CE, type=AWS::S3::Bucket)]:
  ✓ has only one element
  ▼ single element CdkResource(name=SecureBucket1ED1C5CE, type=AWS::S3::Bucket):
    ▼ [[[], [[[[[[]]]]], [[], [], [], []]], [], []]]:
      ✗ is equal to [[[], [[[[[[]]]]], [[], [], [], []]], [], []]] (ObjectNode)
              found [[[], [[[[[[]]]]], [[], [], [], []]], [], []]] (ObjectNode)

Suspect this is related to the formatValue() method, given that JsonNode implements Iterable.

Expected behaviour: show the toString() output of the JsonNode objects

strikt 0.34.1. Issue occurs with or without strikt-jackson module.

@incrop
Copy link

incrop commented Jan 16, 2023

There was a similar issue: #75
Looks like it was fixed (#80), but then jackson team removed toString() from ObjectNode, and preferToString() does not help anymore: FasterXML/jackson-databind@8ec1e5e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants