use of org.javers.core.Javers in project tutorials by eugenp.
the class JaversUnitTest method givenPersonObject_whenApplyModificationOnIt_thenShouldDetectChange.
@Test
public void givenPersonObject_whenApplyModificationOnIt_thenShouldDetectChange() {
// given
Javers javers = JaversBuilder.javers().build();
Person person = new Person(1, "Michael Program");
Person personAfterModification = new Person(1, "Michael Java");
// when
Diff diff = javers.compare(person, personAfterModification);
// then
ValueChange change = diff.getChangesByType(ValueChange.class).get(0);
assertThat(diff.getChanges()).hasSize(1);
assertThat(change.getPropertyName()).isEqualTo("name");
assertThat(change.getLeft()).isEqualTo("Michael Program");
assertThat(change.getRight()).isEqualTo("Michael Java");
}
use of org.javers.core.Javers in project backend by CatalogueOfLife.
the class TaxonResourceTest method create.
@Test
public void create() throws Exception {
RULE.startNamesIndex();
Taxon t = createTaxon();
t.setId(adminCreds(base).post(json(t), String.class));
Taxon t2 = userCreds(base.path(t.getId())).get(Taxon.class);
assertNotNull(t2);
// manually created taxa will always be of origin USER
assertEquals(t.getId(), t2.getId());
TestEntityGenerator.nullifyUserDate(t2);
prepareEquals(t);
prepareEquals(t2);
t2.getName().setId(null);
Javers javers = JaversBuilder.javers().build();
Diff diff = javers.compare(t, t2);
System.out.println(diff);
assertEquals(t, t2);
}
use of org.javers.core.Javers in project backend by CatalogueOfLife.
the class DuplicateMapperTest method printDiff.
void printDiff(Object o1, Object o2) {
Javers javers = JaversBuilder.javers().build();
Diff diff = javers.compare(o1, o2);
System.out.println(diff);
}
use of org.javers.core.Javers in project backend by CatalogueOfLife.
the class MapperTestBase method printDiff.
protected void printDiff(Object o1, Object o2) {
Javers javers = JaversBuilder.javers().build();
Diff diff = javers.compare(o1, o2);
System.out.println(diff);
}
Aggregations