Skip to content

Commit

Permalink
Add tests for invalid null arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
2bllw8 committed Sep 9, 2021
1 parent a975e63 commit f2ab0dc
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/src/test/java/exe/bbllw8/either/EitherTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,26 @@ public void leftAndRightNotEqual() {
Either.<Integer, Integer>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
Expand Down

0 comments on commit f2ab0dc

Please sign in to comment.