Skip to content
Browse files

Deprecate TypeSafeMatcher which is now provided by Hamcrest

  • Loading branch information...
1 parent 4f1dbfc commit 8b9dfefada78a74b6b1fa34ff0bab298267f8210 @marcphilipp committed
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.junit.internal.matchers.TypeSafeMatcher;
+import org.hamcrest.TypeSafeMatcher;
/**
* Matchers on a PrintableResult, to enable JUnit self-tests.
View
3 src/main/java/org/junit/internal/matchers/TypeSafeMatcher.java
@@ -10,7 +10,10 @@
* This simply implements the null check, checks the type and then casts.
*
* @author Joe Walnes
+ *
+ * @deprecated Please use {@link org.hamcrest.TypeSafeMatcher}.
*/
+@Deprecated
public abstract class TypeSafeMatcher<T> extends BaseMatcher<T> {
private Class<?> expectedType;
View
2 src/main/java/org/junit/rules/ExpectedException.java
@@ -6,8 +6,8 @@
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.StringDescription;
+import org.hamcrest.TypeSafeMatcher;
import org.junit.Assert;
-import org.junit.internal.matchers.TypeSafeMatcher;
import org.junit.runners.model.Statement;
/**
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
20 src/test/java/org/junit/tests/experimental/rules/ExpectedExceptionRuleTest.java
@@ -2,15 +2,13 @@
import static org.hamcrest.CoreMatchers.any;
import static org.hamcrest.CoreMatchers.both;
+import static org.hamcrest.CoreMatchers.startsWith;
import static org.junit.Assert.assertThat;
import static org.junit.experimental.results.PrintableResult.testResult;
import static org.junit.experimental.results.ResultMatchers.hasSingleFailureContaining;
import static org.junit.experimental.results.ResultMatchers.isSuccessful;
-import org.hamcrest.Description;
-import org.hamcrest.Matcher;
import org.junit.Rule;
import org.junit.Test;
-import org.junit.internal.matchers.TypeSafeMatcher;
import org.junit.rules.ExpectedException;
public class ExpectedExceptionRuleTest {
@@ -174,22 +172,6 @@ public void throwsMore() {
}
}
-
-
- private static Matcher<String> startsWith(final String prefix) {
- return new TypeSafeMatcher<String>() {
- public void describeTo(Description description) {
- description.appendText("starts with ");
- description.appendText(prefix);
- }
-
- @Override
- public boolean matchesSafely(String item) {
- return item.startsWith(prefix);
- }
- };
- }
-
@Test
public void failsWithMatcher() {
assertThat(testResult(ExpectedMessageMatcherFails.class),
View
2 src/test/java/org/junit/tests/running/classes/ParentRunnerTest.java
@@ -8,8 +8,8 @@
import java.util.List;
import org.hamcrest.Matcher;
+import org.hamcrest.TypeSafeMatcher;
import org.junit.Test;
-import org.junit.internal.matchers.TypeSafeMatcher;
import org.junit.runner.Description;
import org.junit.runner.JUnitCore;
import org.junit.runner.Request;

0 comments on commit 8b9dfef

Please sign in to comment.
Something went wrong with that request. Please try again.