1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.collections4.functors;
18
19 import static org.junit.jupiter.api.Assertions.assertFalse;
20 import static org.junit.jupiter.api.Assertions.assertNotNull;
21 import static org.junit.jupiter.api.Assertions.assertTrue;
22
23 import org.apache.commons.collections4.Predicate;
24 import org.junit.jupiter.api.BeforeEach;
25 import org.junit.jupiter.api.Test;
26
27 public abstract class AbstractPredicateTest {
28
29 protected Object cObject;
30 protected String cString;
31 protected Integer cInteger;
32
33 protected <T> void assertPredicateFalse(final Predicate<T> predicate, final T testObject) {
34 assertFalse(predicate.evaluate(testObject));
35 }
36
37 protected <T> void assertPredicateTrue(final Predicate<T> predicate, final T testObject) {
38 assertTrue(predicate.evaluate(testObject));
39 }
40
41
42
43
44 protected abstract Predicate<?> generatePredicate();
45
46 @BeforeEach
47 public void initializeTestObjects() throws Exception {
48 cObject = new Object();
49 cString = "Hello";
50 cInteger = Integer.valueOf(6);
51 }
52
53 @Test
54 public void testPredicateSanityTests() throws Exception {
55 final Predicate<?> predicate = generatePredicate();
56 assertNotNull(predicate);
57 }
58
59 }