Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix javac build

There seems to be a problem compiling calls of the new

	assertThat(T actual, Matcher<? super T> matcher)

using javac and matchers like `hasItem` and `both` that also use 
`Matcher<? super T>` as parameter.
  • Loading branch information...
commit c2bdb1a2d89a61edc6c5cf7dd2a07b3f2119eea2 1 parent a26d3de
@marcphilipp authored
View
4 src/test/java/org/junit/tests/experimental/theories/ParameterSignatureTest.java
@@ -1,6 +1,5 @@
package org.junit.tests.experimental.theories;
-import static org.hamcrest.CoreMatchers.hasItem;
import static org.hamcrest.CoreMatchers.isA;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
@@ -10,6 +9,7 @@
import java.lang.reflect.Method;
import java.util.List;
+import org.hamcrest.CoreMatchers;
import org.junit.Test;
import org.junit.experimental.theories.DataPoint;
import org.junit.experimental.theories.ParameterSignature;
@@ -51,6 +51,6 @@ public void getAnnotations() throws SecurityException,
List<Annotation> annotations= ParameterSignature.signatures(method)
.get(0).getAnnotations();
assertThat(annotations,
- hasItem(isA(TestedOn.class)));
+ CoreMatchers.<TestedOn> hasItem(isA(TestedOn.class)));
}
}
View
5 src/test/java/org/junit/tests/experimental/theories/runner/UnsuccessfulWithDataPointFields.java
@@ -1,13 +1,14 @@
package org.junit.tests.experimental.theories.runner;
-import static org.hamcrest.CoreMatchers.both;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.junit.experimental.results.PrintableResult.testResult;
import static org.junit.experimental.results.ResultMatchers.failureCountIs;
import static org.junit.experimental.results.ResultMatchers.hasFailureContaining;
import static org.junit.experimental.results.ResultMatchers.hasSingleFailureContaining;
+import org.hamcrest.CoreMatchers;
import org.junit.Test;
+import org.junit.experimental.results.PrintableResult;
import org.junit.experimental.theories.DataPoint;
import org.junit.experimental.theories.Theories;
import org.junit.experimental.theories.Theory;
@@ -99,7 +100,7 @@ public void numbers(int x) {
public void dataPointsMustBeStatic() {
assertThat(
testResult(DataPointsMustBeStatic.class),
- both(failureCountIs(2))
+ CoreMatchers.<PrintableResult> both(failureCountIs(2))
.and(
hasFailureContaining("DataPoint field THREE must be static"))
.and(
View
6 src/test/java/org/junit/tests/running/methods/AnnotationTest.java
@@ -9,6 +9,7 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
+import org.hamcrest.CoreMatchers;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
@@ -143,7 +144,10 @@ public void testTestAndTeardownFailure() throws Exception {
Result runner= core.run(TestAndTeardownFailureTest.class);
assertEquals(1, runner.getRunCount());
assertEquals(2, runner.getFailureCount());
- assertThat(runner.getFailures().toString(), both(containsString("hereAfter")).and(containsString("inTest")));
+ assertThat(
+ runner.getFailures().toString(),
+ CoreMatchers.<String> both(containsString("hereAfter")).and(
+ containsString("inTest")));
}
static public class TeardownAfterFailureTest {
Please sign in to comment.
Something went wrong with that request. Please try again.