Renamed unit tests for functors package.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1374400 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
da525f24ad
commit
c39fd281b7
|
@ -31,7 +31,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.collections.functors.AllPredicate;
|
import org.apache.commons.collections.functors.AllPredicate;
|
||||||
import org.apache.commons.collections.functors.BasicPredicateTestBase;
|
import org.apache.commons.collections.functors.AbstractPredicateTest;
|
||||||
import org.apache.commons.collections.functors.EqualPredicate;
|
import org.apache.commons.collections.functors.EqualPredicate;
|
||||||
import org.apache.commons.collections.functors.ExceptionPredicate;
|
import org.apache.commons.collections.functors.ExceptionPredicate;
|
||||||
import org.apache.commons.collections.functors.FalsePredicate;
|
import org.apache.commons.collections.functors.FalsePredicate;
|
||||||
|
@ -50,7 +50,7 @@ import org.junit.Test;
|
||||||
* @author Matt Benson
|
* @author Matt Benson
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("boxing")
|
@SuppressWarnings("boxing")
|
||||||
public class TestPredicateUtils extends BasicPredicateTestBase {
|
public class TestPredicateUtils extends AbstractPredicateTest {
|
||||||
/**
|
/**
|
||||||
* Set up instance variables required by this test case.
|
* Set up instance variables required by this test case.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -27,19 +27,17 @@ import java.util.Collections;
|
||||||
/**
|
/**
|
||||||
* Base class for tests of AnyPredicate, AllPredicate, and OnePredicate.
|
* Base class for tests of AnyPredicate, AllPredicate, and OnePredicate.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since 3.0
|
||||||
* @version $Revision$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @author Edwin Tellman
|
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractTestAnyAllOnePredicate<T> extends AbstractTestCompositePredicate<T> {
|
public abstract class AbstractAnyAllOnePredicateTest<T> extends AbstractCompositePredicateTest<T> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new <code>TestCompositePredicate</code>.
|
* Creates a new <code>TestCompositePredicate</code>.
|
||||||
*
|
*
|
||||||
* @param testValue the value which the mock predicates should expect to see (may be null).
|
* @param testValue the value which the mock predicates should expect to see (may be null).
|
||||||
*/
|
*/
|
||||||
protected AbstractTestAnyAllOnePredicate(final T testValue) {
|
protected AbstractAnyAllOnePredicateTest(final T testValue) {
|
||||||
super(testValue);
|
super(testValue);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.apache.commons.collections.Closure;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public abstract class BasicClosureTestBase {
|
public abstract class AbstractClosureTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void closureSanityTests() throws Exception {
|
public void closureSanityTests() throws Exception {
|
|
@ -29,19 +29,17 @@ import java.util.List;
|
||||||
/**
|
/**
|
||||||
* Base class for tests of composite predicates.
|
* Base class for tests of composite predicates.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since 3.0
|
||||||
* @version $Revision$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @author Edwin Tellman
|
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractTestCompositePredicate<T> extends MockPredicateTestBase<T> {
|
public abstract class AbstractCompositePredicateTest<T> extends AbstractMockPredicateTest<T> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new <code>TestCompositePredicate</code>.
|
* Creates a new <code>TestCompositePredicate</code>.
|
||||||
*
|
*
|
||||||
* @param testValue the value which the mock predicates should expect to see (may be null).
|
* @param testValue the value which the mock predicates should expect to see (may be null).
|
||||||
*/
|
*/
|
||||||
protected AbstractTestCompositePredicate(final T testValue) {
|
protected AbstractCompositePredicateTest(final T testValue) {
|
||||||
super(testValue);
|
super(testValue);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,12 +30,10 @@ import java.util.List;
|
||||||
* Base class for tests of predicates which delegate to other predicates when evaluating an object. This class
|
* Base class for tests of predicates which delegate to other predicates when evaluating an object. This class
|
||||||
* provides methods to create and verify mock predicates to which to delegate.
|
* provides methods to create and verify mock predicates to which to delegate.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since 3.0
|
||||||
* @version $Revision$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @author Edwin Tellman
|
|
||||||
*/
|
*/
|
||||||
public abstract class MockPredicateTestBase<T> {
|
public abstract class AbstractMockPredicateTest<T> {
|
||||||
/**
|
/**
|
||||||
* Mock predicates created by a single test case which need to be verified after the test completes.
|
* Mock predicates created by a single test case which need to be verified after the test completes.
|
||||||
*/
|
*/
|
||||||
|
@ -51,7 +49,7 @@ public abstract class MockPredicateTestBase<T> {
|
||||||
*
|
*
|
||||||
* @param testValue the value to pass to mock predicates.
|
* @param testValue the value to pass to mock predicates.
|
||||||
*/
|
*/
|
||||||
protected MockPredicateTestBase(final T testValue) {
|
protected AbstractMockPredicateTest(final T testValue) {
|
||||||
this.testValue = testValue;
|
this.testValue = testValue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public abstract class BasicPredicateTestBase {
|
public abstract class AbstractPredicateTest {
|
||||||
protected Object cObject;
|
protected Object cObject;
|
||||||
protected String cString;
|
protected String cString;
|
||||||
protected Integer cInteger;
|
protected Integer cInteger;
|
|
@ -13,18 +13,16 @@ import java.util.Collections;
|
||||||
/**
|
/**
|
||||||
* Tests the org.apache.commons.collections.functors.AllPredicate class.
|
* Tests the org.apache.commons.collections.functors.AllPredicate class.
|
||||||
*
|
*
|
||||||
* @since Commons Collections 3.0
|
* @since 3.0
|
||||||
* @version $Revision$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @author Edwin Tellman
|
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("boxing")
|
@SuppressWarnings("boxing")
|
||||||
public class TestAllPredicate extends AbstractTestAnyAllOnePredicate<Integer> {
|
public class AllPredicateTest extends AbstractAnyAllOnePredicateTest<Integer> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new <code>TestAllPredicate</code>.
|
* Creates a new <code>TestAllPredicate</code>.
|
||||||
*/
|
*/
|
||||||
public TestAllPredicate() {
|
public AllPredicateTest() {
|
||||||
super(42);
|
super(42);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.apache.commons.collections.FunctorException;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class TestCatchAndRethrowClosure extends BasicClosureTestBase {
|
public class CatchAndRethrowClosureTest extends AbstractClosureTest {
|
||||||
|
|
||||||
private static <T> Closure<T> generateIOExceptionClosure() {
|
private static <T> Closure<T> generateIOExceptionClosure() {
|
||||||
return new CatchAndRethrowClosure<T>() {
|
return new CatchAndRethrowClosure<T>() {
|
|
@ -23,7 +23,7 @@ import org.apache.commons.collections.Predicate;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
||||||
public class TestComparatorPredicate extends BasicPredicateTestBase {
|
public class ComparatorPredicateTest extends AbstractPredicateTest {
|
||||||
private class TestComparator<T extends Comparable<T>> implements Comparator<T> {
|
private class TestComparator<T extends Comparable<T>> implements Comparator<T> {
|
||||||
public int compare(T first, T second) {
|
public int compare(T first, T second) {
|
||||||
return first.compareTo(second);
|
return first.compareTo(second);
|
|
@ -24,7 +24,7 @@ import org.apache.commons.collections.Predicate;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
||||||
public class TestEqualPredicate extends BasicPredicateTestBase {
|
public class EqualPredicateTest extends AbstractPredicateTest {
|
||||||
private static final EqualsTestObject FALSE_OBJECT = new EqualsTestObject(false);
|
private static final EqualsTestObject FALSE_OBJECT = new EqualsTestObject(false);
|
||||||
private static final EqualsTestObject TRUE_OBJECT = new EqualsTestObject(true);
|
private static final EqualsTestObject TRUE_OBJECT = new EqualsTestObject(true);
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.apache.commons.collections.Predicate;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
||||||
public class TestNullPredicate extends BasicPredicateTestBase {
|
public class NullPredicateTest extends AbstractPredicateTest {
|
||||||
@Test
|
@Test
|
||||||
public void testNullPredicate() {
|
public void testNullPredicate() {
|
||||||
assertSame(NullPredicate.nullPredicate(), NullPredicate.nullPredicate());
|
assertSame(NullPredicate.nullPredicate(), NullPredicate.nullPredicate());
|
Loading…
Reference in New Issue