From 815755b9594d1577d282dc47120e68fe0aa8c4f1 Mon Sep 17 00:00:00 2001 From: pacien Date: Fri, 29 Mar 2019 18:09:01 +0100 Subject: rename ambiguous method --- src/main/java/org/pacien/lemonad/attempt/Attempt.java | 2 +- src/test/java/org/pacien/lemonad/attempt/AttemptTest.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/main/java/org/pacien/lemonad/attempt/Attempt.java b/src/main/java/org/pacien/lemonad/attempt/Attempt.java index fc437ad..e36ac4b 100644 --- a/src/main/java/org/pacien/lemonad/attempt/Attempt.java +++ b/src/main/java/org/pacien/lemonad/attempt/Attempt.java @@ -84,7 +84,7 @@ public interface Attempt { * @param mapper a function producing an {@link Attempt}, called with the current error if this {@link Attempt} is a failure. * @return this {@link Attempt} if it is a success, or the alternative {@link Attempt} retrieved from the supplier otherwise. */ - default Attempt mapFailure(@NonNull Function> mapper) { + default Attempt mapError(@NonNull Function> mapper) { //noinspection unchecked return (Attempt) (isFailure() ? mapper.apply(getError()) : this); } diff --git a/src/test/java/org/pacien/lemonad/attempt/AttemptTest.java b/src/test/java/org/pacien/lemonad/attempt/AttemptTest.java index 1b165e8..6d87335 100644 --- a/src/test/java/org/pacien/lemonad/attempt/AttemptTest.java +++ b/src/test/java/org/pacien/lemonad/attempt/AttemptTest.java @@ -87,7 +87,7 @@ class AttemptTest { var fault2 = 2; Attempt.success(result0) - .mapFailure(__ -> fail()) + .mapError(__ -> fail()) .mapResult(res -> Attempt.success(result1)) .mapResult(res -> { assertEquals(result1, res); @@ -95,11 +95,11 @@ class AttemptTest { }) .ifSuccess(__ -> fail()) .mapResult(__ -> fail()) - .mapFailure(f -> { + .mapError(f -> { assertEquals(fault0, f); return Attempt.failure(fault1); }) - .mapFailure(f -> { + .mapError(f -> { assertEquals(fault1, f); return Attempt.success(result2); }) -- cgit v1.2.3