Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Rollback to hamcrest 1.1

  • Loading branch information...
commit 4e2455b1f142bdf8f07383082638718695e51224 1 parent 017ce04
David Saff authored
Showing with 175 additions and 166 deletions.
  1. +1 −1  .classpath
  2. BIN  lib/hamcrest-core-1.1.jar
  3. BIN  lib/hamcrest-core-1.2.jar
  4. +2 −2 src/main/java/org/junit/Assume.java
  5. +1 −1  src/main/java/org/junit/experimental/results/ResultMatchers.java
  6. +28 −8 src/main/java/org/junit/internal/matchers/CombinableMatcher.java
  7. +16 −7 src/main/java/org/junit/internal/matchers/Each.java
  8. +61 −9 src/main/java/org/junit/internal/matchers/IsCollectionContaining.java
  9. +2 −4 src/main/java/org/junit/internal/matchers/StringContains.java
  10. +0 −4 src/main/java/org/junit/internal/matchers/SubstringMatcher.java
  11. +0 −4 src/main/java/org/junit/internal/matchers/TypeSafeMatcher.java
  12. +18 −75 src/main/java/org/junit/matchers/JUnitMatchers.java
  13. +2 −0  src/test/java/org/junit/tests/AllTests.java
  14. +8 −28 src/test/java/org/junit/tests/assertion/BothTest.java
  15. +13 −0 src/test/java/org/junit/tests/assertion/EachTest.java
  16. +1 −1  src/test/java/org/junit/tests/experimental/AssumptionTest.java
  17. +1 −1  src/test/java/org/junit/tests/experimental/AssumptionViolatedExceptionTest.java
  18. +1 −1  src/test/java/org/junit/tests/experimental/max/MaxStarterTest.java
  19. +1 −1  src/test/java/org/junit/tests/experimental/parallel/ParallelClassTest.java
  20. +1 −1  src/test/java/org/junit/tests/experimental/parallel/ParallelMethodTest.java
  21. +2 −1  src/test/java/org/junit/tests/experimental/results/PrintableResultTest.java
  22. +1 −2  src/test/java/org/junit/tests/experimental/results/ResultMatchersTest.java
  23. +1 −1  src/test/java/org/junit/tests/experimental/rules/RulesTest.java
  24. +1 −1  src/test/java/org/junit/tests/experimental/rules/TimeoutRuleTest.java
  25. +1 −1  src/test/java/org/junit/tests/experimental/theories/ParameterSignatureTest.java
  26. +1 −1  src/test/java/org/junit/tests/experimental/theories/ParameterizedAssertionErrorTest.java
  27. +2 −2 src/test/java/org/junit/tests/experimental/theories/runner/UnsuccessfulWithDataPointFields.java
  28. +1 −1  src/test/java/org/junit/tests/experimental/theories/runner/WhenNoParametersMatch.java
  29. +3 −3 src/test/java/org/junit/tests/experimental/theories/runner/WithDataPointMethod.java
  30. +1 −1  src/test/java/org/junit/tests/experimental/theories/runner/WithOnlyTestAnnotations.java
  31. +1 −1  src/test/java/org/junit/tests/junit3compatibility/AllTestsTest.java
  32. +1 −1  src/test/java/org/junit/tests/running/classes/ParameterizedTestTest.java
  33. +1 −1  src/test/java/org/junit/tests/running/methods/AnnotationTest.java
  34. +1 −1  src/test/java/org/junit/tests/running/methods/TimeoutTest.java
View
2  .classpath
@@ -3,6 +3,6 @@
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/test/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="lib" path="lib/hamcrest-core-1.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/hamcrest-core-1.1.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
View
BIN  lib/hamcrest-core-1.1.jar
Binary file not shown
View
BIN  lib/hamcrest-core-1.2.jar
Binary file not shown
View
4 src/main/java/org/junit/Assume.java
@@ -4,9 +4,9 @@
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
-import static org.hamcrest.CoreMatchers.everyItem;
import org.hamcrest.Matcher;
import org.junit.internal.AssumptionViolatedException;
+import org.junit.internal.matchers.Each;
/**
* A set of methods useful for stating assumptions about the conditions in which a test is meaningful.
@@ -44,7 +44,7 @@ public static void assumeTrue(boolean b) {
* @param objects
*/
public static void assumeNotNull(Object... objects) {
- assumeThat(asList(objects), everyItem(notNullValue()));
+ assumeThat(asList(objects), Each.each(notNullValue()));
}
/**
View
2  src/main/java/org/junit/experimental/results/ResultMatchers.java
@@ -3,7 +3,7 @@
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
-import org.hamcrest.TypeSafeMatcher;
+import org.junit.internal.matchers.TypeSafeMatcher;
/**
* Matchers on a PrintableResult, to enable JUnit self-tests.
View
36 src/main/java/org/junit/internal/matchers/CombinableMatcher.java
@@ -1,14 +1,34 @@
package org.junit.internal.matchers;
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.CoreMatchers.anyOf;
+import org.hamcrest.BaseMatcher;
+import org.hamcrest.Description;
import org.hamcrest.Matcher;
-/**
- * @deprectated Use org.hamcrest.core.CombinableMatcher directly
- */
-@Deprecated
-public class CombinableMatcher<T> extends org.hamcrest.core.CombinableMatcher<T> {
- // should only be using static factories
- private CombinableMatcher(Matcher<? super T> matcher) {
- super(matcher);
+public class CombinableMatcher<T> extends BaseMatcher<T> {
+
+ private final Matcher<? extends T> fMatcher;
+
+ public CombinableMatcher(Matcher<? extends T> matcher) {
+ fMatcher= matcher;
+ }
+
+ public boolean matches(Object item) {
+ return fMatcher.matches(item);
+ }
+
+ public void describeTo(Description description) {
+ description.appendDescriptionOf(fMatcher);
+ }
+
+ @SuppressWarnings("unchecked")
+ public CombinableMatcher<T> and(Matcher<? extends T> matcher) {
+ return new CombinableMatcher<T>(allOf(matcher, fMatcher));
+ }
+
+ @SuppressWarnings("unchecked")
+ public CombinableMatcher<T> or(Matcher<? extends T> matcher) {
+ return new CombinableMatcher<T>(anyOf(matcher, fMatcher));
}
}
View
23 src/main/java/org/junit/internal/matchers/Each.java
@@ -1,15 +1,24 @@
package org.junit.internal.matchers;
+import static org.hamcrest.CoreMatchers.not;
+import static org.junit.internal.matchers.IsCollectionContaining.hasItem;
+import org.hamcrest.BaseMatcher;
+import org.hamcrest.Description;
import org.hamcrest.Matcher;
-import org.hamcrest.core.Every;
-
-/**
- * @deprecated use org.hamcrest.core.Every
- */
-@Deprecated
public class Each {
public static <T> Matcher<Iterable<T>> each(final Matcher<T> individual) {
- return Every.everyItem(individual);
+ final Matcher<Iterable<T>> allItemsAre = not(hasItem(not(individual)));
+
+ return new BaseMatcher<Iterable<T>>() {
+ public boolean matches(Object item) {
+ return allItemsAre.matches(item);
+ }
+
+ public void describeTo(Description description) {
+ description.appendText("each ");
+ individual.describeTo(description);
+ }
+ };
}
}
View
70 src/main/java/org/junit/internal/matchers/IsCollectionContaining.java
@@ -1,15 +1,67 @@
package org.junit.internal.matchers;
+import static org.hamcrest.core.AllOf.allOf;
+import static org.hamcrest.core.IsEqual.equalTo;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.hamcrest.Description;
+import org.hamcrest.Factory;
import org.hamcrest.Matcher;
// Copied (hopefully temporarily) from hamcrest-library
-/**
- * @deprecated use org.hamcrest.core.IsCollectionContaining directly
- */
-@Deprecated
-public class IsCollectionContaining<T> extends org.hamcrest.core.IsCollectionContaining<T> {
- // Client code should just use static factories, so this should be OK
- private IsCollectionContaining(Matcher<? super T> elementMatcher) {
- super(elementMatcher);
- }
+public class IsCollectionContaining<T> extends TypeSafeMatcher<Iterable<T>> {
+ private final Matcher<? extends T> elementMatcher;
+
+ public IsCollectionContaining(Matcher<? extends T> elementMatcher) {
+ this.elementMatcher = elementMatcher;
+ }
+
+ @Override
+ public boolean matchesSafely(Iterable<T> collection) {
+ for (T item : collection) {
+ if (elementMatcher.matches(item)){
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void describeTo(Description description) {
+ description
+ .appendText("a collection containing ")
+ .appendDescriptionOf(elementMatcher);
+ }
+
+ @Factory
+ public static <T> Matcher<Iterable<T>> hasItem(Matcher<? extends T> elementMatcher) {
+ return new IsCollectionContaining<T>(elementMatcher);
+ }
+
+ @Factory
+ public static <T> Matcher<Iterable<T>> hasItem(T element) {
+ return hasItem(equalTo(element));
+ }
+
+ @Factory
+ public static <T> Matcher<Iterable<T>> hasItems(Matcher<? extends T>... elementMatchers) {
+ Collection<Matcher<? extends Iterable<T>>> all
+ = new ArrayList<Matcher<? extends Iterable<T>>>(elementMatchers.length);
+ for (Matcher<? extends T> elementMatcher : elementMatchers) {
+ all.add(hasItem(elementMatcher));
+ }
+ return allOf(all);
+ }
+
+ @Factory
+ public static <T> Matcher<Iterable<T>> hasItems(T... elements) {
+ Collection<Matcher<? extends Iterable<T>>> all
+ = new ArrayList<Matcher<? extends Iterable<T>>>(elements.length);
+ for (T element : elements) {
+ all.add(hasItem(element));
+ }
+ return allOf(all);
+ }
+
}
View
6 src/main/java/org/junit/internal/matchers/StringContains.java
@@ -2,14 +2,12 @@
*/
package org.junit.internal.matchers;
-import org.hamcrest.CoreMatchers;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;
/**
- * @deprectated Use org.hamcrest.core.StringContains directly
+ * Tests if the argument is a string that contains a substring.
*/
-@Deprecated
public class StringContains extends SubstringMatcher {
public StringContains(String substring) {
super(substring);
@@ -27,7 +25,7 @@ protected String relationship() {
@Factory
public static Matcher<String> containsString(String substring) {
- return CoreMatchers.containsString(substring);
+ return new StringContains(substring);
}
}
View
4 src/main/java/org/junit/internal/matchers/SubstringMatcher.java
@@ -2,10 +2,6 @@
import org.hamcrest.Description;
-/**
- * @deprectated Use org.hamcrest.core.SubstringMatcher directly
- */
-@Deprecated
public abstract class SubstringMatcher extends TypeSafeMatcher<String> {
protected final String substring;
View
4 src/main/java/org/junit/internal/matchers/TypeSafeMatcher.java
@@ -10,10 +10,6 @@
*
* @author Joe Walnes
*/
-/**
- * @deprectated Use org.hamcrest.TypeSafeMatcher
- */
-@Deprecated
public abstract class TypeSafeMatcher<T> extends BaseMatcher<T> {
private Class<?> expectedType;
View
93 src/main/java/org/junit/matchers/JUnitMatchers.java
@@ -1,14 +1,10 @@
package org.junit.matchers;
-import static org.hamcrest.CoreMatchers.anyOf;
-import static org.hamcrest.CoreMatchers.equalTo;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hamcrest.CoreMatchers;
import org.hamcrest.Matcher;
-import org.hamcrest.core.CombinableMatcher;
+import org.junit.internal.matchers.CombinableMatcher;
+import org.junit.internal.matchers.Each;
+import org.junit.internal.matchers.IsCollectionContaining;
+import org.junit.internal.matchers.StringContains;
/**
* Convenience import class: these are useful matchers for use with the assertThat method, but they are
@@ -18,31 +14,25 @@
/**
* @param element
* @return A matcher matching any collection containing element
- * @deprecated Use org.hamcrest.CoreMatchers.hasItem
*/
- @Deprecated
- public static <T> Matcher<Iterable<? super T>> hasItem(T element) {
- return CoreMatchers.<T>hasItem(element);
+ public static <T> org.hamcrest.Matcher<java.lang.Iterable<T>> hasItem(T element) {
+ return IsCollectionContaining.hasItem(element);
}
/**
* @param elementMatcher
* @return A matcher matching any collection containing an element matching elementMatcher
- * @deprecated Use org.hamcrest.CoreMatchers.hasItem
*/
- @Deprecated
- public static <T> Matcher<Iterable<? super T>> hasItem(Matcher<? super T> elementMatcher) {
- return CoreMatchers.<T>hasItem(elementMatcher);
+ public static <T> org.hamcrest.Matcher<java.lang.Iterable<T>> hasItem(org.hamcrest.Matcher<? extends T> elementMatcher) {
+ return IsCollectionContaining.hasItem(elementMatcher);
}
/**
* @param elements
* @return A matcher matching any collection containing every element in elements
- * @deprecated Use org.hamcrest.CoreMatchers.hasItems
*/
- @Deprecated
public static <T> org.hamcrest.Matcher<java.lang.Iterable<T>> hasItems(T... elements) {
- return CoreMatchers.hasItems(elements);
+ return IsCollectionContaining.hasItems(elements);
}
/**
@@ -50,31 +40,25 @@
* @return A matcher matching any collection containing at least one element that matches
* each matcher in elementMatcher (this may be one element matching all matchers,
* or different elements matching each matcher)
- * @deprecated Use org.hamcrest.CoreMatchers.hasItems
*/
- @Deprecated
- public static <T> Matcher<Iterable<T>> hasItems(Matcher<? super T>... elementMatchers) {
- return CoreMatchers.hasItems(elementMatchers);
+ public static <T> org.hamcrest.Matcher<java.lang.Iterable<T>> hasItems(org.hamcrest.Matcher<? extends T>... elementMatchers) {
+ return IsCollectionContaining.hasItems(elementMatchers);
}
/**
* @param elementMatcher
* @return A matcher matching any collection in which every element matches elementMatcher
- * @deprecated use CoreMatchers.everyItem directly
*/
- @Deprecated
- public static <T> Matcher<Iterable<T>> each(final Matcher<T> elementMatcher) {
- return CoreMatchers.everyItem(elementMatcher);
+ public static <T> Matcher<Iterable<T>> everyItem(final Matcher<T> elementMatcher) {
+ return Each.each(elementMatcher);
}
/**
* @param substring
* @return a matcher matching any string that contains substring
- * @deprecated Use org.hamcrest.CoreMatchers.containsString
*/
- @Deprecated
public static org.hamcrest.Matcher<java.lang.String> containsString(java.lang.String substring) {
- return CoreMatchers.containsString(substring);
+ return StringContains.containsString(substring);
}
/**
@@ -84,57 +68,16 @@
* </pre>
*/
public static <T> CombinableMatcher<T> both(Matcher<T> matcher) {
- return CoreMatchers.both(matcher);
+ return new CombinableMatcher<T>(matcher);
}
/**
* This is useful for fluently combining matchers where either may pass, for example:
* <pre>
- * assertThat(string, either(containsString("a")).or(containsString("b")));
+ * assertThat(string, both(containsString("a")).and(containsString("b")));
* </pre>
- *
- * If you want to say either(is(3)).or(is(4)), and are prevented,
- * please see isOneOf(...) below.
*/
public static <T> CombinableMatcher<T> either(Matcher<T> matcher) {
- return CoreMatchers.either(matcher);
- }
-
- /**
- * This is sugar for the situation where you want to specify
- * a finite list of concrete objects that can match.
- * For example:
- * <pre>
- * assertThat(string, isOneOf("a", "b", "c"));
- * // is equivalent to
- * assertThat(string, anyOf(is("a"), is("b"), is("c")))
- * </pre>
- */
- public static <T> Matcher<T> isOneOf(T... objects) {
- List<Matcher<? super T>> matchers = new ArrayList<Matcher<? super T>>();
- for (T each : objects) {
- matchers.add(equalTo(each));
- }
- return anyOf(matchers);
- }
-
- /**
- * Loosens type parameter, in order to use a Matcher
- * in a place where Java doesn't want to type-check:
- *
- * Goofy example:
- * <pre>
- * assertThat(3, matches(containsString("a")));
- * </pre>
- *
- * Real example:
- * <pre>
- * assertThat(3, either(matches(is(String.class))).or(
- * matches(is(Integer.class))));
- * </pre>
- */
- @SuppressWarnings("unchecked")
- public static <T> Matcher<T> matches(Matcher<?> matcher) {
- return (Matcher<T>)matcher;
- }
+ return new CombinableMatcher<T>(matcher);
+ }
}
View
2  src/test/java/org/junit/tests/AllTests.java
@@ -7,6 +7,7 @@
import org.junit.runners.Suite.SuiteClasses;
import org.junit.tests.assertion.AssertionTest;
import org.junit.tests.assertion.BothTest;
+import org.junit.tests.assertion.EachTest;
import org.junit.tests.deprecated.JUnit4ClassRunnerTest;
import org.junit.tests.description.AnnotatedDescriptionTest;
import org.junit.tests.description.SuiteDescriptionTest;
@@ -110,6 +111,7 @@
AnnotatedDescriptionTest.class,
BothTest.class,
AssumptionViolatedExceptionTest.class,
+ EachTest.class,
ExperimentalTests.class,
InheritedTestTest.class,
TestClassTest.class,
View
36 src/test/java/org/junit/tests/assertion/BothTest.java
@@ -1,19 +1,12 @@
package org.junit.tests.assertion;
-import static org.hamcrest.CoreMatchers.any;
-import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.sameInstance;
import static org.junit.Assert.assertThat;
import static org.junit.Assume.assumeTrue;
import static org.junit.matchers.JUnitMatchers.both;
+import static org.junit.matchers.JUnitMatchers.containsString;
import static org.junit.matchers.JUnitMatchers.either;
-import static org.junit.matchers.JUnitMatchers.isOneOf;
-import static org.junit.matchers.JUnitMatchers.matches;
-
-import java.util.Arrays;
-
import org.hamcrest.Matcher;
import org.junit.Test;
import org.junit.experimental.theories.DataPoint;
@@ -24,18 +17,17 @@
@RunWith(Theories.class)
public class BothTest {
@DataPoint
- public static Matcher<? super Integer> IS_3= is(3);
+ public static Matcher<Integer> IS_3= is(3);
@DataPoint
- public static Matcher<? super Integer> IS_4= is(4);
+ public static Matcher<Integer> IS_4= is(4);
@DataPoint
public static int THREE= 3;
@Test
public void bothPasses() {
- assertThat(3, both(any(Integer.class)).and(is(3)));
- assertThat("ab", both(containsString("a")).and(containsString("b")));
+ assertThat(3, both(is(Integer.class)).and(is(3)));
}
@Theory
@@ -54,18 +46,7 @@ public void bothFails(int value, Matcher<Integer> first,
@Test
public void eitherPasses() {
- assertThat(3, either(sameInstance(3)).or(sameInstance(4)));
- assertThat(3, either(matches(is(String.class))).or(
- matches(is(Integer.class))));
- assertThat("a", either(sameInstance("a")).or(sameInstance("b")));
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void isOneOfPasses() {
- assertThat(3, isOneOf(3, 4));
- assertThat(Arrays.asList("a"), isOneOf(Arrays.asList("a"), Arrays
- .asList("b")));
+ assertThat(3, either(is(3)).or(is(4)));
}
@Theory
@@ -83,9 +64,8 @@ public void isOneOfPasses() {
|| third.matches(value));
assertThat(value, either(first).or(second).or(third));
}
-
- @Test
- public void superclassesAreOkInSecondPositionOnly() {
- assertThat("a", both(containsString("a")).and(is(String.class)));
+
+ @Test public void subclassesAreOkInSecondPositionOnly() {
+ assertThat(3, both(is(Integer.class)).and(is(3)));
}
}
View
13 src/test/java/org/junit/tests/assertion/EachTest.java
@@ -0,0 +1,13 @@
+package org.junit.tests.assertion;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import org.junit.Test;
+import org.junit.internal.matchers.Each;
+
+public class EachTest {
+ @Test
+ public void eachDescription() {
+ assertThat(Each.each(is("a")).toString(), is("each is \"a\""));
+ }
+}
View
2  src/test/java/org/junit/tests/experimental/AssumptionTest.java
@@ -1,6 +1,5 @@
package org.junit.tests.experimental;
-import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
@@ -10,6 +9,7 @@
import static org.junit.Assume.assumeTrue;
import static org.junit.experimental.results.PrintableResult.testResult;
import static org.junit.experimental.results.ResultMatchers.isSuccessful;
+import static org.junit.internal.matchers.StringContains.containsString;
import org.junit.Assume;
import org.junit.Before;
import org.junit.BeforeClass;
View
2  src/test/java/org/junit/tests/experimental/AssumptionViolatedExceptionTest.java
@@ -1,10 +1,10 @@
package org.junit.tests.experimental;
-import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;
import static org.junit.Assume.assumeThat;
+import static org.junit.internal.matchers.StringContains.containsString;
import org.hamcrest.Matcher;
import org.hamcrest.StringDescription;
import org.junit.Test;
View
2  src/test/java/org/junit/tests/experimental/max/MaxStarterTest.java
@@ -1,11 +1,11 @@
package org.junit.tests.experimental.max;
-import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import static org.junit.matchers.JUnitMatchers.containsString;
import java.io.File;
import java.util.ArrayList;
View
2  src/test/java/org/junit/tests/experimental/parallel/ParallelClassTest.java
@@ -4,9 +4,9 @@
import static org.junit.Assert.assertTrue;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
-import org.hamcrest.TypeSafeMatcher;
import org.junit.Test;
import org.junit.experimental.ParallelComputer;
+import org.junit.internal.matchers.TypeSafeMatcher;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.RunWith;
View
2  src/test/java/org/junit/tests/experimental/parallel/ParallelMethodTest.java
@@ -4,9 +4,9 @@
import static org.junit.Assert.assertTrue;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
-import org.hamcrest.TypeSafeMatcher;
import org.junit.Test;
import org.junit.experimental.ParallelComputer;
+import org.junit.internal.matchers.TypeSafeMatcher;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
View
3  src/test/java/org/junit/tests/experimental/results/PrintableResultTest.java
@@ -2,8 +2,8 @@
import static java.util.Arrays.asList;
import static org.hamcrest.CoreMatchers.allOf;
-import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertThat;
+import static org.junit.internal.matchers.StringContains.containsString;
import java.util.Arrays;
@@ -17,6 +17,7 @@
@RunWith(Theories.class)
public class PrintableResultTest {
+ @SuppressWarnings("unchecked")
@Theory(nullsAccepted= false)
public void backTraceHasGoodToString(String descriptionName,
final String stackTraceClassName) {
View
3  src/test/java/org/junit/tests/experimental/results/ResultMatchersTest.java
@@ -1,12 +1,11 @@
package org.junit.tests.experimental.results;
-import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
+import static org.junit.internal.matchers.StringContains.containsString;
import org.junit.Test;
import org.junit.experimental.results.ResultMatchers;
import org.junit.experimental.theories.Theory;
-
public class ResultMatchersTest {
@Test
public void hasFailuresHasGoodDescription() {
View
2  src/test/java/org/junit/tests/experimental/rules/RulesTest.java
@@ -1,6 +1,5 @@
package org.junit.tests.experimental.rules;
-import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
@@ -8,6 +7,7 @@
import static org.junit.Assert.fail;
import static org.junit.experimental.results.PrintableResult.testResult;
import static org.junit.experimental.results.ResultMatchers.hasSingleFailureContaining;
+import static org.junit.matchers.JUnitMatchers.containsString;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
View
2  src/test/java/org/junit/tests/experimental/rules/TimeoutRuleTest.java
@@ -1,8 +1,8 @@
package org.junit.tests.experimental.rules;
-import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
+import static org.junit.matchers.JUnitMatchers.containsString;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
View
2  src/test/java/org/junit/tests/experimental/theories/ParameterSignatureTest.java
@@ -1,10 +1,10 @@
package org.junit.tests.experimental.theories;
-import static org.hamcrest.CoreMatchers.hasItem;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.Assume.assumeTrue;
+import static org.junit.matchers.JUnitMatchers.hasItem;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
View
2  src/test/java/org/junit/tests/experimental/theories/ParameterizedAssertionErrorTest.java
@@ -1,10 +1,10 @@
package org.junit.tests.experimental.theories;
-import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertThat;
import static org.junit.Assume.assumeThat;
+import static org.junit.internal.matchers.StringContains.containsString;
import org.junit.Test;
import org.junit.experimental.theories.DataPoint;
import org.junit.experimental.theories.Theories;
View
4 src/test/java/org/junit/tests/experimental/theories/runner/UnsuccessfulWithDataPointFields.java
@@ -1,12 +1,12 @@
package org.junit.tests.experimental.theories.runner;
-import static org.junit.matchers.JUnitMatchers.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 static org.junit.matchers.JUnitMatchers.both;
import org.junit.Test;
import org.junit.experimental.theories.DataPoint;
import org.junit.experimental.theories.Theories;
@@ -123,4 +123,4 @@ public void theoriesMustBePublic() {
testResult(TheoriesMustBePublic.class),
hasSingleFailureContaining("public"));
}
-}
+}
View
2  src/test/java/org/junit/tests/experimental/theories/runner/WhenNoParametersMatch.java
@@ -1,11 +1,11 @@
package org.junit.tests.experimental.theories.runner;
-import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertThat;
import static org.junit.Assume.assumeThat;
import static org.junit.experimental.results.PrintableResult.testResult;
+import static org.junit.internal.matchers.StringContains.containsString;
import org.hamcrest.Matcher;
import org.junit.experimental.theories.DataPoint;
import org.junit.experimental.theories.DataPoints;
View
6 src/test/java/org/junit/tests/experimental/theories/runner/WithDataPointMethod.java
@@ -1,13 +1,13 @@
package org.junit.tests.experimental.theories.runner;
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.CoreMatchers.everyItem;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
import static org.junit.experimental.results.PrintableResult.testResult;
import static org.junit.experimental.results.ResultMatchers.isSuccessful;
+import static org.junit.internal.matchers.Each.each;
+import static org.junit.internal.matchers.StringContains.containsString;
import java.lang.reflect.Method;
import java.util.ArrayList;
@@ -147,6 +147,6 @@ public void ignoreDataPointMethodsWithoutAnnotation() throws Throwable {
private Matcher<Iterable<Failure>> empty() {
Matcher<Failure> nullValue= nullValue();
- return everyItem(nullValue);
+ return each(nullValue);
}
}
View
2  src/test/java/org/junit/tests/experimental/theories/runner/WithOnlyTestAnnotations.java
@@ -1,12 +1,12 @@
package org.junit.tests.experimental.theories.runner;
-import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
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.isSuccessful;
+import static org.junit.matchers.JUnitMatchers.containsString;
import org.junit.Test;
import org.junit.experimental.theories.DataPoint;
import org.junit.experimental.theories.Theories;
View
2  src/test/java/org/junit/tests/junit3compatibility/AllTestsTest.java
@@ -1,9 +1,9 @@
package org.junit.tests.junit3compatibility;
-import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
+import static org.junit.matchers.JUnitMatchers.containsString;
import junit.framework.JUnit4TestAdapter;
import junit.framework.TestCase;
import junit.framework.TestSuite;
View
2  src/test/java/org/junit/tests/running/classes/ParameterizedTestTest.java
@@ -1,9 +1,9 @@
package org.junit.tests.running.classes;
-import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.experimental.results.PrintableResult.testResult;
+import static org.junit.matchers.JUnitMatchers.containsString;
import java.util.Arrays;
import java.util.Collection;
View
2  src/test/java/org/junit/tests/running/methods/AnnotationTest.java
@@ -1,8 +1,8 @@
package org.junit.tests.running.methods;
-import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertThat;
import static org.junit.matchers.JUnitMatchers.both;
+import static org.junit.matchers.JUnitMatchers.containsString;
import java.util.Collection;
import java.util.HashSet;
View
2  src/test/java/org/junit/tests/running/methods/TimeoutTest.java
@@ -1,11 +1,11 @@
package org.junit.tests.running.methods;
-import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import static org.junit.matchers.JUnitMatchers.containsString;
import java.io.PrintWriter;
import java.io.StringWriter;
Please sign in to comment.
Something went wrong with that request. Please try again.