diff options
| author | Ben Culkin <scorpress@gmail.com> | 2021-02-26 16:15:54 -0500 |
|---|---|---|
| committer | Ben Culkin <scorpress@gmail.com> | 2021-02-26 16:15:54 -0500 |
| commit | a7352711e1d6c36b16235c042e139946ad6fb35c (patch) | |
| tree | 914d2232b2309af3d1468fd56e15e741e3080f44 /src/test/java/bjc/data | |
| parent | 7783bf18664f45c76fe4e5f583dac0803087de95 (diff) | |
Update
Diffstat (limited to 'src/test/java/bjc/data')
| -rw-r--r-- | src/test/java/bjc/data/EitherTest.java | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/src/test/java/bjc/data/EitherTest.java b/src/test/java/bjc/data/EitherTest.java index bbf94b7..ef2d12b 100644 --- a/src/test/java/bjc/data/EitherTest.java +++ b/src/test/java/bjc/data/EitherTest.java @@ -2,24 +2,34 @@ package bjc.data; import static org.junit.Assert.*; -import org.junit.Test; +import java.util.*; -/** - * Test Either - * @author Ben Culkin - * - */ -public class EitherTest { +import org.junit.*; - /** - * Do a test of Either. - */ +@SuppressWarnings("javadoc") +public class EitherTest +{ + private Either<String, String> leftEither; + private Either<String, String> rightEither; + + @Before + public void setUp() throws Exception { + leftEither = Either.left("left"); + rightEither = Either.right("right"); + } + + @Test + public void testIsLeft() { + assertTrue("isLeft properly marks left eithers", leftEither.isLeft()); + assertFalse("isLeft properly marks right eithers", rightEither.isLeft()); + } + @Test - public void test() { - Either<String, String> left = Either.left("left"); - Either<String, String> right = Either.right("right"); - - assertNotEquals(left, right); + public void testGetLeft() { + assertEquals("getLeft treats left eithers properly", + Optional.of("left"), leftEither.getLeft()); + assertEquals("getLeft treats right eithers properly", + Optional.empty(), rightEither.getLeft()); } } |
