entities: add static builder and constructors and make previous revision Optional
This commit is contained in:
parent
cf723da38a
commit
1046b6c5ae
1 changed files with 13 additions and 4 deletions
|
@ -10,6 +10,15 @@ import org.junit.Test;
|
||||||
*/
|
*/
|
||||||
public class IdentityTest implements WithAssertions {
|
public class IdentityTest implements WithAssertions {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void functorLawMapIdEqualsId() {
|
||||||
|
//given
|
||||||
|
final String id = "id";
|
||||||
|
//when
|
||||||
|
|
||||||
|
//then
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void canMapIdentityFromStringToInteger() {
|
public void canMapIdentityFromStringToInteger() {
|
||||||
//given
|
//given
|
||||||
|
@ -20,6 +29,10 @@ public class IdentityTest implements WithAssertions {
|
||||||
assertIdentityContains(idInt, 3);
|
assertIdentityContains(idInt, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private <T> void assertIdentityContains(final Identity<T> identity, final T expected) {
|
||||||
|
identity.map(id -> assertThat(id).isEqualTo(expected));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void canFluentlyComposeFunctions() {
|
public void canFluentlyComposeFunctions() {
|
||||||
//given
|
//given
|
||||||
|
@ -34,8 +47,4 @@ public class IdentityTest implements WithAssertions {
|
||||||
assertIdentityContains(idBytes, "par".getBytes());
|
assertIdentityContains(idBytes, "par".getBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> void assertIdentityContains(final Identity<T> identity, final T expected) {
|
|
||||||
identity.map(id -> assertThat(id).isEqualTo(expected));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue