From 0ac555a6d383fa76626a6123e008365e005558a3 Mon Sep 17 00:00:00 2001 From: pacien Date: Fri, 5 Apr 2019 03:00:45 +0200 Subject: add missing map method --- src/test/java/org/pacien/lemonad/attempt/AttemptTest.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/test') 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 { @Test void testTransformationFlow() { var result0 = 0; var result1 = "res"; - var result2 = 0L; - var fault0 = 0; - var fault1 = 1; - var fault2 = 2; + var result2 = true; + var result3 = 0L; + var fault0 = 0L; + var fault1 = 0; + var fault2 = "fail"; + var fault3 = false; Attempt.success(result0) .mapError(__ -> fail()) @@ -109,6 +111,9 @@ class AttemptTest { return Attempt.failure(fault2); }) .ifSuccess(__ -> fail()) - .ifFailure(f -> assertEquals(fault2, f)); + .ifFailure(f -> assertEquals(fault2, f)) + .map(__ -> Attempt.failure(fault3), __ -> Attempt.success(result3)) + .ifSuccess(result -> assertEquals(result3, result)) + .ifFailure(__ -> fail()); } } -- cgit v1.2.3