diff --git a/README.md b/README.md index 0170a8f..a0486a8 100644 --- a/README.md +++ b/README.md @@ -29,11 +29,14 @@ There is no point in using this if your flows are "all or nothing". If there are io.github.theangrydev business-flows - 8.3.0 + 9.0.0 ``` ## Releases +### 9.0.0 +* Removed the `HappyPath.happyAttempt` method that took an `Attempt` parameter (closes [#12](https://github.com/theangrydev/business-flows/issues/12)). This change is not backwards compatible. The recommended alternative is described in the migration advice, which can be found [here](https://github.com/theangrydev/business-flows/wiki/9.0.0-Migration-Advice) + ### 8.3.0 * Add methods `consume` and `consumeOrThrow` to end a flow by performing some action that ends in a void (closes [#8](https://github.com/theangrydev/business-flows/issues/8)) diff --git a/src/main/java/io/github/theangrydev/businessflows/HappyPath.java b/src/main/java/io/github/theangrydev/businessflows/HappyPath.java index f1b0a8a..857aafb 100644 --- a/src/main/java/io/github/theangrydev/businessflows/HappyPath.java +++ b/src/main/java/io/github/theangrydev/businessflows/HappyPath.java @@ -43,22 +43,6 @@ static HappyPath happyPathAttempt(Attempt The type of happy object this {@link HappyPath} may represent - * @param The type of sad object this {@link HappyPath} may represent - * @return A {@link HappyPath} that is either happy on the inside or a technical failure - */ - static HappyPath happyAttempt(Attempt attempt) { - try { - return happyPath(attempt.attempt()); - } catch (Exception technicalFailure) { - return technicalFailure(technicalFailure); - } - } - /** * Attempt an action that produces a {@link Happy}, mapping any technical failure to a {@link Sad}. * diff --git a/src/test/java/io/github/theangrydev/businessflows/HappyPathTest.java b/src/test/java/io/github/theangrydev/businessflows/HappyPathTest.java index 804aad3..35c6a0f 100644 --- a/src/test/java/io/github/theangrydev/businessflows/HappyPathTest.java +++ b/src/test/java/io/github/theangrydev/businessflows/HappyPathTest.java @@ -79,15 +79,6 @@ public void happyPathAttemptThatFailsResultsInTechnicalFailure() { assertThat(actualTechnicalFailure).isSameAs(technicalFailure); } - @Test - public void happyAttemptThatSucceedsWithNoFailureMappingResultsInHappy() { - Happy originalHappy = new Happy(); - - Happy actualHappy = HappyPath.happyAttempt(() -> originalHappy).get(); - - assertThat(actualHappy).isSameAs(originalHappy); - } - @Test public void happyAttemptThatSucceedsWithNoSadFailureMappingResultsInHappy() { Happy originalHappy = new Happy(); @@ -97,16 +88,6 @@ public void happyAttemptThatSucceedsWithNoSadFailureMappingResultsInHappy() { assertThat(actualHappy).isSameAs(originalHappy); } - @Test - public void happyAttemptThatFailsWithUncaughtExceptionIsATechnicalFailure() { - Exception exceptionDuringAttempt = new Exception(); - - Exception actualException = HappyPath.happyAttempt(() -> {throw exceptionDuringAttempt;}) - .ifTechnicalFailure().get(); - - assertThat(actualException).isSameAs(exceptionDuringAttempt); - } - @Test public void happyAttemptThatFailsWithUncaughtExceptionIsASadPath() { Sad expectedSad = new Sad();