Java Code Examples for org.javers.core.Javers#commit()
The following examples show how to use
org.javers.core.Javers#commit() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChangedPropertyNamesForNullifiedValuesCase.java From javers with Apache License 2.0 | 6 votes |
@Test public void shouldCalculateChangedPropertyNamesForNullifiedValues() { //given Javers javers = JaversBuilder.javers().build(); SimpleTypes obj = new SimpleTypes("1"); javers.commit("anonymous", obj); //when obj.shortNumber = -1; javers.commit("anonymous", obj); CdoSnapshot s = javers.getLatestSnapshot("1", SimpleTypes.class).get(); //then Assertions.assertThat(s.getChanged()).containsExactly("shortNumber"); //when obj.nullify(); javers.commit("anonymous", obj); s = javers.getLatestSnapshot("1", SimpleTypes.class).get(); //then Assertions.assertThat(s.getChanged()).hasSize(11); }
Example 2
Source File: Case249GenericId.java From javers with Apache License 2.0 | 5 votes |
@Test public void shouldCommitEntityWithSerializableId() { //given Javers javers = JaversBuilder.javers(). registerJaversRepository(H2RepositoryFactory.create()).build(); //when Account acc = new Account("1","2"); javers.commit("author", acc); //then CdoSnapshot snapshot = javers.getLatestSnapshot("1", Account.class).get(); Assertions.assertThat(snapshot.getPropertyValue("id")).isEqualTo("1"); Assertions.assertThat(snapshot.getPropertyValue("value")).isEqualTo("2"); }