aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorpacien2019-04-05 03:00:45 +0200
committerpacien2019-04-05 03:00:45 +0200
commit0ac555a6d383fa76626a6123e008365e005558a3 (patch)
treefbe83c72aea87f342abe80b151edfdcb97cf26a7 /src/test/java
parent560d8ce7529b634163e53a83461438ebc5ea585c (diff)
downloadjava-lemonad-0ac555a6d383fa76626a6123e008365e005558a3.tar.gz
add missing map method
Diffstat (limited to 'src/test/java')
-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}