On Github javers / wjug-talk
git clone https://github.com/javers/javers-demo.git gradlew bootRunRequires mongod at localhost, Java8
package org.javers.core.commit ... public final class Commit { private final CommitId id; private final List<CdoSnapshot> snapshots; private final String author; private final LocalDateTime commitDate; private final Diff diff; ... }
package org.javers.core.metamodel.object; ... public final class CdoSnapshot extends Cdo { private CommitId commitId; private final Map<Property, Object> state; ... }
package org.javers.core.diff; ... public class Diff implements Visitable<ChangeVisitor>{ private final List<Change> changes; ... }
package org.javers.core.diff; ... public abstract class Change implements Visitable<ChangeVisitor> { private final GlobalCdoId affectedCdoId; private transient Optional<Object> affectedCdo; ... }
User classes are mapped to:
Java types are mapped to:
def "should append newObjects to diff"() { given: def left = buildLiveGraph(dummyUser().withName("1") .build()) def right = buildLiveGraph(dummyUser().withName("1").withDetails(5) .build()) when: def changes = new NewObjectAppender() .getChangeSet(new GraphPair(left, right)) then: changes.size() == 1 assertThat(changes[0]).isNewObject() }