From 0b8d5c83955c1473b7c165c22980264e6e4c3781 Mon Sep 17 00:00:00 2001 From: Christian Femers Date: Mon, 7 Dec 2020 06:40:45 +0100 Subject: [PATCH] Add tests for the new cases --- .../java/de/tum/in/testuser/InputOutputUser.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/test/java/de/tum/in/testuser/InputOutputUser.java b/src/test/java/de/tum/in/testuser/InputOutputUser.java index 4ff02fe5..fde34d4d 100644 --- a/src/test/java/de/tum/in/testuser/InputOutputUser.java +++ b/src/test/java/de/tum/in/testuser/InputOutputUser.java @@ -107,6 +107,20 @@ void testLinesMatch(IOTester tester) { "|| (( |", // "Something"); }).isInstanceOf(AssertionFailedError.class).hasMessageContainingAll("more actual lines than expected: 1"); + + assertThatThrownBy(() -> { + tester.out().assertLinesMatch("This should not pass", // + ">> 11 >>", // + "ABCDEF"); + }).isInstanceOf(AssertionFailedError.class) + .hasMessageContainingAll("expected line #2:`ABCDEF` not found - actual lines depleted"); + + assertThatThrownBy(() -> { + tester.out().assertLinesMatch("This should not pass", // + ">> 12 >>", // + "ABCDEF"); + }).isInstanceOf(AssertionFailedError.class).hasMessageContainingAll( + "The output does not contain enough lines for the test to work, only 11 lines found."); } @PublicTest