Skip to content

Commit

Permalink
Merge pull request #1732 from cpoerschke/main-reduce-warnings-multi-c…
Browse files Browse the repository at this point in the history
…ommit

Address some warnings (in 4 parts)
  • Loading branch information
kcooney authored Jan 3, 2022
2 parents 7167b23 + 43df829 commit cc7c500
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
2 changes: 0 additions & 2 deletions src/main/java/org/junit/internal/Classes.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public Classes() {
* {@link Classes}.
*
* @param className Name of the class.
* @throws ClassNotFoundException
*/
public static Class<?> getClass(String className) throws ClassNotFoundException {
return getClass(className, Classes.class);
Expand All @@ -34,7 +33,6 @@ public static Class<?> getClass(String className) throws ClassNotFoundException
*
* @param className Name of the class.
* @param callingClass Class that is requesting a the class
* @throws ClassNotFoundException
* @since 4.13
*/
public static Class<?> getClass(String className, Class<?> callingClass) throws ClassNotFoundException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public Builder withLookingForStuckThread(boolean enable) {
* Builds a {@link FailOnTimeout} instance using the values in this builder,
* wrapping the given statement.
*
* @param statement
* @param statement statement to build
*/
public FailOnTimeout build(Statement statement) {
if (statement == null) {
Expand Down
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
1 change: 0 additions & 1 deletion src/main/java/org/junit/runner/FilterFactories.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class FilterFactories {
*
* @param request the request that will be filtered
* @param filterSpec the filter specification
* @throws org.junit.runner.FilterFactory.FilterNotCreatedException
*/
public static Filter createFilterFromFilterSpec(Request request, String filterSpec)
throws FilterFactory.FilterNotCreatedException {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/junit/runner/JUnitCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static Result runClasses(Computer computer, Class<?>... classes) {
}

/**
* @param system
* @param system system to run with
* @param args from main()
*/
Result runMain(JUnitSystem system, String... args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public void testSuiteStarted(Description description) throws Exception {
* <p/>
* Synchronized decorator for {@link RunListener#testSuiteFinished(Description)}.
* @param description the description of the test suite that just ran.
* @throws Exception
* @since 4.13
*/
@Override
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/org/junit/runners/model/FrameworkMember.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ T handlePossibleBridgeMethod(List<T> members) {
}
}
// No shadow or bridge method found. The caller should add *this* member.
return (T) this;
FrameworkMember<? extends T> thisMember = this;
@SuppressWarnings("unchecked")
T result = (T) thisMember;

return result;
}

abstract boolean isBridgeMethod();
Expand Down

0 comments on commit cc7c500

Please sign in to comment.