diff options
Diffstat (limited to 'src/test/java/org/pacien/lemonad')
-rw-r--r-- | src/test/java/org/pacien/lemonad/validation/ValidationTest.java | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/test/java/org/pacien/lemonad/validation/ValidationTest.java b/src/test/java/org/pacien/lemonad/validation/ValidationTest.java index 665f501..fed74a3 100644 --- a/src/test/java/org/pacien/lemonad/validation/ValidationTest.java +++ b/src/test/java/org/pacien/lemonad/validation/ValidationTest.java | |||
@@ -20,6 +20,7 @@ package org.pacien.lemonad.validation; | |||
20 | 20 | ||
21 | import org.junit.jupiter.api.Assertions; | 21 | import org.junit.jupiter.api.Assertions; |
22 | import org.junit.jupiter.api.Test; | 22 | import org.junit.jupiter.api.Test; |
23 | import org.pacien.lemonad.attempt.Attempt; | ||
23 | 24 | ||
24 | import java.util.List; | 25 | import java.util.List; |
25 | import java.util.stream.Stream; | 26 | import java.util.stream.Stream; |
@@ -41,6 +42,7 @@ class ValidationTest { | |||
41 | assertFalse(validation.isInvalid()); | 42 | assertFalse(validation.isInvalid()); |
42 | validation.ifValid(innerSubject -> assertEquals(subject, innerSubject)); | 43 | validation.ifValid(innerSubject -> assertEquals(subject, innerSubject)); |
43 | validation.ifInvalid((__, ___) -> fail()); | 44 | validation.ifInvalid((__, ___) -> fail()); |
45 | assertEquals(Attempt.success(subject), validation.toAttempt()); | ||
44 | } | 46 | } |
45 | 47 | ||
46 | @Test void testInvalidResult() { | 48 | @Test void testInvalidResult() { |
@@ -55,6 +57,7 @@ class ValidationTest { | |||
55 | assertEquals(subject, innerSubject); | 57 | assertEquals(subject, innerSubject); |
56 | assertEquals(errors, innerErrors); | 58 | assertEquals(errors, innerErrors); |
57 | }); | 59 | }); |
60 | assertEquals(Attempt.failure(errors), validation.toAttempt()); | ||
58 | } | 61 | } |
59 | 62 | ||
60 | @Test void testFlatMap() { | 63 | @Test void testFlatMap() { |