1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.functor.core.composite;
18
19 import static org.junit.Assert.assertEquals;
20 import static org.junit.Assert.assertFalse;
21 import static org.junit.Assert.assertNotNull;
22 import static org.junit.Assert.assertTrue;
23
24 import org.apache.commons.functor.BaseFunctorTest;
25 import org.apache.commons.functor.Predicate;
26 import org.apache.commons.functor.Procedure;
27 import org.apache.commons.functor.core.Constant;
28 import org.apache.commons.functor.core.NoOp;
29 import org.junit.Test;
30
31
32
33
34
35 public class TestAbstractLoopProcedure extends BaseFunctorTest {
36
37
38
39
40 protected Object makeFunctor() {
41 return new MockLoopProcedure(Constant.FALSE, NoOp.INSTANCE);
42 }
43
44
45
46 @Test
47 public void testEqualsAndHashCodeWithNullArgs() {
48 Procedure p = new MockLoopProcedure(null,null);
49 assertNotNull(p.toString());
50 assertFalse(p.equals(null));
51 assertTrue(p.equals(p));
52 assertEquals(p.hashCode(),p.hashCode());
53 }
54
55 }
56
57 class MockLoopProcedure extends AbstractLoopProcedure {
58 public MockLoopProcedure(Predicate condition, Procedure action) {
59 super(condition,action);
60 }
61
62 public void run() {
63 }
64 }