I've used javers in a different part of our app. Now I'm adding it to another, and am getting an IllegalArgumentException: argument should not be null. But I have verified (by serializing the objects and logging them) that the 2 objects are NOT null when passed to the compare() method.
Also, this only happens within a unit test run via Mockito. I assume there's a property of the objects that are passed in that is null, and that's what's creating the error. But isn't a null property a valid comparison for javers to detect?
I am using javers version 1.1.
Here's a snippet of my code:
private static final Javers javers = JaversBuilder.javers().build();
Diff difference = javers.compare(object1, object2);
Here's the stack trace:
java.lang.IllegalArgumentException: argument should not be null
at org.javers.common.validation.Validate.argumentIsNotNull(Validate.java:16)
at org.javers.common.validation.Validate.argumentIsNotNull(Validate.java:24)
at org.javers.common.validation.Validate.argumentsAreNotNull(Validate.java:32)
at org.javers.core.metamodel.type.SetType.map(SetType.java:21)
at org.javers.core.diff.appenders.SetChangeAppender.calculateEntryChanges(SetChangeAppender.java:63)
at org.javers.core.diff.appenders.SetChangeAppender.calculateChanges(SetChangeAppender.java:89)
at org.javers.core.diff.appenders.SetChangeAppender.calculateChanges(SetChangeAppender.java:20)
at org.javers.core.diff.DiffFactory.appendChanges(DiffFactory.java:142)
at org.javers.core.diff.DiffFactory.appendPropertyChanges(DiffFactory.java:132)
at org.javers.core.diff.DiffFactory.createAndAppendChanges(DiffFactory.java:114)
at org.javers.core.diff.DiffFactory.create(DiffFactory.java:65)
at org.javers.core.diff.DiffFactory.compare(DiffFactory.java:58)
at org.javers.core.JaversCore.compare(JaversCore.java:75)
I updated to version 1.2.1 and that fixed this problem.