Skip to content

Commit

Permalink
Upgrade to opentest4j 1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
marcphilipp committed Sep 10, 2018
1 parent f05bb52 commit 379d7af
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Expand Up @@ -25,7 +25,7 @@ jmhVersion = 1.21
junit4Version = 4.12
log4jVersion = 2.11.0
mockitoVersion = 2.21.0
ota4jVersion = 1.1.1-SNAPSHOT
ota4jVersion = 1.1.1
surefireVersion = 2.22.0

defaultBuiltBy = JUnit Team
Expand Down
Expand Up @@ -26,9 +26,9 @@ static void expectAssertionFailedError() {
throw new AssertionError("Should have thrown an " + AssertionFailedError.class.getName());
}

static void assertNullMessage(Throwable ex) throws AssertionError {
if (ex.getMessage() != null) {
throw new AssertionError("Exception message should be null, but was [" + ex.getMessage() + "].");
static void assertEmptyMessage(Throwable ex) throws AssertionError {
if (!ex.getMessage().isEmpty()) {
throw new AssertionError("Exception message should be empty, but was [" + ex.getMessage() + "].");
}
}

Expand Down
Expand Up @@ -10,9 +10,9 @@

package org.junit.jupiter.api;

import static org.junit.jupiter.api.AssertionTestUtils.assertEmptyMessage;
import static org.junit.jupiter.api.AssertionTestUtils.assertMessageContains;
import static org.junit.jupiter.api.AssertionTestUtils.assertMessageEquals;
import static org.junit.jupiter.api.AssertionTestUtils.assertNullMessage;
import static org.junit.jupiter.api.AssertionTestUtils.expectAssertionFailedError;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
Expand All @@ -36,7 +36,7 @@ void failWithoutArgument() {
expectAssertionFailedError();
}
catch (AssertionFailedError ex) {
assertNullMessage(ex);
assertEmptyMessage(ex);
}
}

Expand Down Expand Up @@ -69,7 +69,7 @@ void failWithNullString() {
expectAssertionFailedError();
}
catch (AssertionFailedError ex) {
assertNullMessage(ex);
assertEmptyMessage(ex);
}
}

Expand All @@ -80,7 +80,7 @@ void failWithNullMessageSupplier() {
expectAssertionFailedError();
}
catch (AssertionFailedError ex) {
assertNullMessage(ex);
assertEmptyMessage(ex);
}
}

Expand All @@ -104,7 +104,7 @@ void failWithThrowable() {
expectAssertionFailedError();
}
catch (AssertionFailedError ex) {
assertNullMessage(ex);
assertEmptyMessage(ex);
Throwable cause = ex.getCause();
assertMessageContains(cause, "cause");
}
Expand All @@ -131,7 +131,7 @@ void failWithNullStringAndThrowable() {
expectAssertionFailedError();
}
catch (AssertionFailedError ex) {
assertNullMessage(ex);
assertEmptyMessage(ex);
Throwable cause = ex.getCause();
assertMessageContains(cause, "cause");
}
Expand Down
Expand Up @@ -12,7 +12,7 @@ package org.junit.jupiter.api
import org.junit.jupiter.api.AssertEquals.assertEquals
import org.junit.jupiter.api.AssertionTestUtils.assertMessageContains
import org.junit.jupiter.api.AssertionTestUtils.assertMessageEquals
import org.junit.jupiter.api.AssertionTestUtils.assertNullMessage
import org.junit.jupiter.api.AssertionTestUtils.assertEmptyMessage
import org.opentest4j.AssertionFailedError
import java.util.stream.Stream

Expand Down Expand Up @@ -41,15 +41,15 @@ class KotlinFailAssertionsTests {
val ex = assertThrows<AssertionFailedError> {
fail(null as String?)
}
assertNullMessage(ex)
assertEmptyMessage(ex)
}

@Test
fun `fail with null message supplier`() {
val ex = assertThrows<AssertionFailedError> {
fail(null as (() -> String)?)
}
assertNullMessage(ex)
assertEmptyMessage(ex)
}

@Test
Expand All @@ -70,7 +70,7 @@ class KotlinFailAssertionsTests {
val ex = assertThrows<AssertionFailedError> {
fail(Throwable(throwableCause))
}
assertNullMessage(ex)
assertEmptyMessage(ex)
val cause = ex.cause
assertMessageContains(cause, throwableCause)
}
Expand All @@ -93,7 +93,7 @@ class KotlinFailAssertionsTests {
val ex = assertThrows<AssertionFailedError> {
fail(null, Throwable(throwableCause))
}
assertNullMessage(ex)
assertEmptyMessage(ex)
val cause = ex.cause
assertMessageContains(cause, throwableCause)
}
Expand Down

0 comments on commit 379d7af

Please sign in to comment.