Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for bugs #20 and #19 #21

Merged
merged 2 commits into from
Mar 9, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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