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());
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());