Add tests for equality

This commit is contained in:
Paul Campbell 2017-12-10 16:53:41 +00:00
parent dc89a0962f
commit d082215b12

View file

@ -32,6 +32,15 @@ public class MaybeTest {
assertThat(nothing()).isSameAs(nothing()); assertThat(nothing()).isSameAs(nothing());
} }
@Test
public void equality() {
assertThat(just(1)).isEqualTo(just(1));
assertThat(just(1)).isNotEqualTo(just(2));
assertThat(just(1)).isNotEqualTo(nothing());
assertThat(nothing()).isEqualTo(nothing());
assertThat(just(1).equals("1")).isFalse();
}
@Test @Test
public void maybeAllowsNull() { public void maybeAllowsNull() {
assertThat(just(1)).isEqualTo(maybe(1)); assertThat(just(1)).isEqualTo(maybe(1));