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

Specifying the field path for objects with cyclic dependencies is very unintuitive #16

Open
nieldw opened this issue Oct 16, 2015 · 0 comments

Comments

@nieldw
Copy link

nieldw commented Oct 16, 2015

I have a cyclic object graph that looks something like this:

MyObject --> MyGroupingObject --> Set<MyObject>

MyObject has a reference to MyGroupingObject, which has a Set of MyObjects, which each in turn has a MyGroupingObject.

I want to ignore matching the set, and I expect to do it like this:

assertThat(actual, sameBeanAs(expected).ignoring("myGroupingObject.myObjects"));

However, the JSON with cyclic reference pointers looks like this:

{
  "0x1": {
    "myGroupingObject": "0x2"
  },
  "0x2": {
    "myObjects": [
      "0x1",
      "0x3"
    ]
  },
  "0x3": {
    "myGroupingObject": "0x2"
  }
}

In order to ignore "myObjects", I need to do this:

assertThat(actual, sameBeanAs(expected).ignoring("0x2.myObjects").ignoring("0x3"));

This is very unintuitive and requires inspecting the JSON to figure out what the field path is.

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

1 participant