diff --git a/lib/src/test/java/exe/bbllw8/either/EitherTest.java b/lib/src/test/java/exe/bbllw8/either/EitherTest.java index 590fe14..e264466 100644 --- a/lib/src/test/java/exe/bbllw8/either/EitherTest.java +++ b/lib/src/test/java/exe/bbllw8/either/EitherTest.java @@ -22,6 +22,26 @@ public void leftAndRightNotEqual() { Either.right(2).hashCode()); } + @Test(expected = NullPointerException.class) + public void failOnLeftNull() { + Either.left(null); + } + + @Test(expected = NullPointerException.class) + public void failOnRightNull() { + Either.right(null); + } + + @Test(expected = NullPointerException.class) + public void failOnIffLeftNull() { + Either.iff(true, () -> null, () -> 1); + } + + @Test(expected = NullPointerException.class) + public void failOnIffRightNull() { + Either.iff(false, () -> 0, () -> null); + } + @Test public void consistentEquals() { //noinspection AssertBetweenInconvertibleTypes