{And|Or|Not|Field}PredicateTest: Move duplicate code to base class

Each of these test classes declares the exact same inner static
class and helper method.

Remove them and declare them once in the base class instead.

Change-Id: I4f1b8a020b409ad40d6392680cda4061539bc425
This commit is contained in:
David Pursehouse
2015-11-05 17:11:19 +09:00
parent 03d2e4cc27
commit 7e1f643a8f
5 changed files with 20 additions and 81 deletions

View File

@@ -23,27 +23,7 @@ import org.junit.Test;
import java.util.Collections;
public class FieldPredicateTest {
private static final class TestPredicate extends OperatorPredicate<String> {
private TestPredicate(String name, String value) {
super(name, value);
}
@Override
public boolean match(String object) {
return false;
}
@Override
public int getCost() {
return 0;
}
}
private static TestPredicate f(final String name, final String value) {
return new TestPredicate(name, value);
}
public class FieldPredicateTest extends PredicateTest {
@Test
public void testToString() {
assertEquals("author:bob", f("author", "bob").toString());