Skip to content

Commit

Permalink
remove usages of deprecated org.junit.Assert.assertThat()
Browse files Browse the repository at this point in the history
  • Loading branch information
cpoerschke committed Dec 30, 2021
1 parent 7167b23 commit 0391e45
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/java/org/junit/rules/ErrorCollector.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.junit.rules;

import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertThrows;

import java.util.ArrayList;
Expand All @@ -10,6 +9,7 @@
import org.junit.function.ThrowingRunnable;
import org.junit.internal.AssumptionViolatedException;
import org.hamcrest.Matcher;
import org.hamcrest.MatcherAssert;
import org.junit.runners.model.MultipleFailureException;

/**
Expand Down Expand Up @@ -74,7 +74,7 @@ public <T> void checkThat(final T value, final Matcher<T> matcher) {
public <T> void checkThat(final String reason, final T value, final Matcher<T> matcher) {
checkSucceeds(new Callable<Object>() {
public Object call() throws Exception {
assertThat(reason, value, matcher);
MatcherAssert.assertThat(reason, value, matcher);
return value;
}
});
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/junit/rules/ExpectedException.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import static java.lang.String.format;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import static org.junit.internal.matchers.ThrowableCauseMatcher.hasCause;
import static org.junit.internal.matchers.ThrowableMessageMatcher.hasMessage;
import org.hamcrest.Matcher;
import org.hamcrest.MatcherAssert;
import org.hamcrest.StringDescription;
import org.junit.AssumptionViolatedException;
import org.junit.runners.model.Statement;
Expand Down Expand Up @@ -268,7 +268,7 @@ public void evaluate() throws Throwable {

private void handleException(Throwable e) throws Throwable {
if (isAnyExceptionExpected()) {
assertThat(e, matcherBuilder.build());
MatcherAssert.assertThat(e, matcherBuilder.build());
} else {
throw e;
}
Expand Down

0 comments on commit 0391e45

Please sign in to comment.