aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org')
-rw-r--r--src/test/java/org/pacien/lemonad/attempt/AttemptTest.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/test/java/org/pacien/lemonad/attempt/AttemptTest.java b/src/test/java/org/pacien/lemonad/attempt/AttemptTest.java
index 6d87335..bb367dc 100644
--- a/src/test/java/org/pacien/lemonad/attempt/AttemptTest.java
+++ b/src/test/java/org/pacien/lemonad/attempt/AttemptTest.java
@@ -81,10 +81,12 @@ class AttemptTest {
81 @Test void testTransformationFlow() { 81 @Test void testTransformationFlow() {
82 var result0 = 0; 82 var result0 = 0;
83 var result1 = "res"; 83 var result1 = "res";
84 var result2 = 0L; 84 var result2 = true;
85 var fault0 = 0; 85 var result3 = 0L;
86 var fault1 = 1; 86 var fault0 = 0L;
87 var fault2 = 2; 87 var fault1 = 0;
88 var fault2 = "fail";
89 var fault3 = false;
88 90
89 Attempt.success(result0) 91 Attempt.success(result0)
90 .mapError(__ -> fail()) 92 .mapError(__ -> fail())
@@ -109,6 +111,9 @@ class AttemptTest {
109 return Attempt.failure(fault2); 111 return Attempt.failure(fault2);
110 }) 112 })
111 .ifSuccess(__ -> fail()) 113 .ifSuccess(__ -> fail())
112 .ifFailure(f -> assertEquals(fault2, f)); 114 .ifFailure(f -> assertEquals(fault2, f))
115 .map(__ -> Attempt.failure(fault3), __ -> Attempt.success(result3))
116 .ifSuccess(result -> assertEquals(result3, result))
117 .ifFailure(__ -> fail());
113 } 118 }
114} 119}