I found org.javers.core.Javers#commit not works when committing generic-tuple-like object(i.e. org.apache.commons.lang3.tuple.MutablePair etc.)
This exception can be reproduced using the following simple test case:
class Case948CommitGenericTupleLikeObject extends Specification {
class Pair<L, R> {
L left;
R right;
public Pair(L left, R right) {
this.left = left;
this.right = right;
}
@Override
public String toString() {
return "Pair [left=" + left + ", right=" + right + "]";
}
}
def "should tracking work when committing generic-tuple-like object"(){
given:
Javers javers = JaversBuilder.javers().build();
//Pair<Long, String> obj = org.apache.commons.lang3.tuple.MutablePair.of(1L, "foo");
Pair<Long, String> obj = new Pair<>(1L, "foo");
// Map<Long,String> obj = new HashMap();
// obj.put(1L, "foo")
when:
javers.commit("jay", obj);
//obj.setValue("bar");
obj.right = "bar";
// obj.put(1L, "bar")
Commit commit = javers.commit("jay", obj);
then:
commit.getChanges().size() == 1
}
}
The text was updated successfully, but these errors were encountered:
stun4j
changed the title
JaversException CLASS_MAPPING_ERROR when committing tuple-like object
JaversException CLASS_MAPPING_ERROR when committing generic-tuple-like object
Mar 21, 2020
I found org.javers.core.Javers#commit not works when committing generic-tuple-like object(i.e.
org.apache.commons.lang3.tuple.MutablePair
etc.)This exception can be reproduced using the following simple test case:
The text was updated successfully, but these errors were encountered: