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

MongoFlexibleComparisonStrategy failed on embedded document #197

Open
Pgaze opened this issue Jul 12, 2019 · 0 comments
Open

MongoFlexibleComparisonStrategy failed on embedded document #197

Pgaze opened this issue Jul 12, 2019 · 0 comments

Comments

@Pgaze
Copy link

Pgaze commented Jul 12, 2019

Hi,
I'm setting up some tests using noSqlUnit with MongoFlexibleComparisonStrategy.
My expected collection looks like this:
{ "collection_name" : [{ "_id" : ObjectId("5d287f67ad967e020483560e"), "name" : "Bete", "foo" : "19041995", "suivis" : [], "thirdparties" : [ { "applicationName" : "noe", "functionalKey" : "1234", "etatRapprochement" : "automatique", "dateReception" : "shouldBeIgnored" } ] } ] }

As thirdparties.dateReception represents the insertion date, I want to ignore it on comparision.
I so annotated the class with;
@CustomComparisonStrategy(comparisonStrategy = MongoFlexibleComparisonStrategy.class) @IgnorePropertyValue(properties = {"_id","dateReception"})
and the test failed.
If i used these :
@CustomComparisonStrategy(comparisonStrategy = MongoFlexibleComparisonStrategy.class) @IgnorePropertyValue(properties = {"_id","thirdparties"})
the test succeed.
If I assertEquals on other fields, the test still succeed:
assertEquals("1234", t.get(0).getThirdparties().get(0).getFunctionalKey()); assertEquals("noe", t.get(0).getThirdparties().get(0).getApplicationName()); assertEquals("automatique", t.get(0).getThirdparties().get(0).getEtatRapprochement());

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