entities: add static builder and constructors and make previous revision Optional

This commit is contained in:
Paul Campbell 2017-09-30 16:46:49 +01:00
parent cf723da38a
commit 1046b6c5ae

View file

@ -10,6 +10,15 @@ import org.junit.Test;
*/
public class IdentityTest implements WithAssertions {
@Test
public void functorLawMapIdEqualsId() {
//given
final String id = "id";
//when
//then
}
@Test
public void canMapIdentityFromStringToInteger() {
//given
@ -20,6 +29,10 @@ public class IdentityTest implements WithAssertions {
assertIdentityContains(idInt, 3);
}
private <T> void assertIdentityContains(final Identity<T> identity, final T expected) {
identity.map(id -> assertThat(id).isEqualTo(expected));
}
@Test
public void canFluentlyComposeFunctions() {
//given
@ -34,8 +47,4 @@ public class IdentityTest implements WithAssertions {
assertIdentityContains(idBytes, "par".getBytes());
}
private <T> void assertIdentityContains(final Identity<T> identity, final T expected) {
identity.map(id -> assertThat(id).isEqualTo(expected));
}
}