diff --git a/oleaster-matcher/src/main/java/com/mscharhag/oleaster/matcher/matchers/ExceptionMatcher.java b/oleaster-matcher/src/main/java/com/mscharhag/oleaster/matcher/matchers/ExceptionMatcher.java index 3f95360..6e8a7b9 100644 --- a/oleaster-matcher/src/main/java/com/mscharhag/oleaster/matcher/matchers/ExceptionMatcher.java +++ b/oleaster-matcher/src/main/java/com/mscharhag/oleaster/matcher/matchers/ExceptionMatcher.java @@ -68,8 +68,8 @@ public void toThrow(Class expectedExceptionClass, Strin Arguments.ensureNotNull(expectedMessage, "expectedMessage cannot be null"); this.toThrow(expectedExceptionClass); String exceptionMessage = this.exception.getMessage(); - Expectations.expectTrue(expectedMessage.equals(exceptionMessage), - "Expected exception message '%s' but was '%s'", exceptionMessage, exceptionMessage); + Expectations.expectTrue(expectedMessage.equals(exceptionMessage), + "Expected exception message '%s' but was '%s'", expectedMessage, exceptionMessage); } private void runCodeBlock(CodeBlock block) { diff --git a/oleaster-matcher/src/test/java/com/mscharhag/oleaster/matcher/matchers/ExceptionMatcherTest.java b/oleaster-matcher/src/test/java/com/mscharhag/oleaster/matcher/matchers/ExceptionMatcherTest.java index 9b00f5f..894b249 100644 --- a/oleaster-matcher/src/test/java/com/mscharhag/oleaster/matcher/matchers/ExceptionMatcherTest.java +++ b/oleaster-matcher/src/test/java/com/mscharhag/oleaster/matcher/matchers/ExceptionMatcherTest.java @@ -32,7 +32,8 @@ public class ExceptionMatcherTest { }); it("fails if the exception message is not equal to the expected message", () -> { - TestUtil.expectAssertionError(() -> matcher.toThrow(IllegalArgumentException.class, "foo")); + String expectedMessage = "Expected exception message 'foo' but was 'test exception'"; + TestUtil.expectAssertionError(() -> matcher.toThrow(IllegalArgumentException.class, "foo"), expectedMessage); }); it("is ok if it is checked for a super class of the thrown exception", () -> { diff --git a/oleaster-runner/src/main/java/com/mscharhag/oleaster/runner/OleasterRunner.java b/oleaster-runner/src/main/java/com/mscharhag/oleaster/runner/OleasterRunner.java index c9db822..4f61408 100644 --- a/oleaster-runner/src/main/java/com/mscharhag/oleaster/runner/OleasterRunner.java +++ b/oleaster-runner/src/main/java/com/mscharhag/oleaster/runner/OleasterRunner.java @@ -78,12 +78,6 @@ protected Description describeChild(Spec child) { } - @Override - public Description getDescription() { - return Description.createSuiteDescription(this.getTestClass().getJavaClass().getName()); - } - - protected SuiteBuilder createSuiteBuilder() { return new StaticSupportingSuiteBuilder(); } diff --git a/oleaster-runner/src/test/java/com/mscharhag/oleaster/runner/OleasterRunnerTest.java b/oleaster-runner/src/test/java/com/mscharhag/oleaster/runner/OleasterRunnerTest.java index 1c2e889..274eecc 100644 --- a/oleaster-runner/src/test/java/com/mscharhag/oleaster/runner/OleasterRunnerTest.java +++ b/oleaster-runner/src/test/java/com/mscharhag/oleaster/runner/OleasterRunnerTest.java @@ -52,6 +52,11 @@ public void buildTestSuite(SuiteBuilder sb) { runner = new OleasterRunner(TestClass.class); }); + it("adds the filtered children to the suite", () -> { + int numberOfChildren = runner.getDescription().getChildren().size(); + assertEquals(2, numberOfChildren); + }); + describe("when specs are obtained from the test class using getChildren()", () -> { beforeEach(() -> {