Skip to content

Commit

Permalink
Merge pull request #21 from WouterOet/master
Browse files Browse the repository at this point in the history
Fix for bugs #20 and #19
  • Loading branch information
mscharhag committed Mar 9, 2015
2 parents 19c6a6b + 3f865e1 commit 2356a5c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public <T extends Exception> void toThrow(Class<T> 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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", () -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(() -> {
Expand Down

0 comments on commit 2356a5c

Please sign in to comment.