From ca49a94a7d0d823ebf1a0c42580ee9dacf0f951f Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Fri, 21 Apr 2017 18:10:14 +0100 Subject: [PATCH] ConditionalTest: clean up helper methods --- .../kemitix/conditional/ConditionalTest.java | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/src/test/java/net/kemitix/conditional/ConditionalTest.java b/src/test/java/net/kemitix/conditional/ConditionalTest.java index 67c52a1..f249ffc 100644 --- a/src/test/java/net/kemitix/conditional/ConditionalTest.java +++ b/src/test/java/net/kemitix/conditional/ConditionalTest.java @@ -180,23 +180,43 @@ public class ConditionalTest { } private void thenBothResponsesRun() { - assertThat(thenFlag).isTrue(); - assertThat(otherwiseFlag).isTrue(); + theThenResponseRan(); + theOtherwiseResponseRan(); } private void thenTheThenResponseRuns() { - assertThat(thenFlag).isTrue(); - assertThat(otherwiseFlag).isFalse(); + theThenResponseRan(); + theOtherwiseResponseDidNotRun(); } private void thenTheOtherwiseResponseRuns() { - assertThat(thenFlag).isFalse(); - assertThat(otherwiseFlag).isTrue(); + theThenResponseDidNotRun(); + theOtherwiseResponseRan(); + } + + private void theOtherwiseResponseRan() { + assertThat(otherwiseFlag).as("otherwise response runs") + .isTrue(); + } + + private void theThenResponseRan() { + assertThat(thenFlag).as("then response runs") + .isTrue(); + } + + private void theOtherwiseResponseDidNotRun() { + assertThat(otherwiseFlag).as("otherwise response does not run") + .isFalse(); + } + + private void theThenResponseDidNotRun() { + assertThat(thenFlag).as("then response does not run") + .isFalse(); } private void thenNoResponseRuns() { - assertThat(thenFlag).isFalse(); - assertThat(otherwiseFlag).isFalse(); + theThenResponseDidNotRun(); + theOtherwiseResponseDidNotRun(); } private void when(final boolean firstClause, final boolean secondClause) {