Add class with Sone-specific matchers.
[Sone.git] / src / test / java / net / pterodactylus / sone / freenet / wot / TrustTest.java
index 93eebb8..102afb4 100644 (file)
 
 package net.pterodactylus.sone.freenet.wot;
 
-import static java.util.regex.Pattern.compile;
+import static net.pterodactylus.sone.Matchers.matches;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.is;
 import static org.hamcrest.Matchers.not;
 import static org.hamcrest.Matchers.nullValue;
 
-import org.hamcrest.Description;
-import org.hamcrest.Matcher;
-import org.hamcrest.TypeSafeMatcher;
 import org.junit.Test;
 
 /**
@@ -73,18 +70,4 @@ public class TrustTest {
                assertThat(trustString, matches("\\b2\\b"));
        }
 
-       private static Matcher<String> matches(final String regex) {
-               return new TypeSafeMatcher<String>() {
-                       @Override
-                       protected boolean matchesSafely(String item) {
-                               return compile(regex).matcher(item).find();
-                       }
-
-                       @Override
-                       public void describeTo(Description description) {
-                               description.appendText("matches: ").appendValue(regex);
-                       }
-               };
-       }
-
 }