View Javadoc
1 package test.net.sourceforge.pmd.util; 2 3 import junit.framework.TestCase; 4 import net.sourceforge.pmd.util.Applier; 5 import net.sourceforge.pmd.util.UnaryFunction; 6 7 import java.util.ArrayList; 8 import java.util.List; 9 10 public class ApplierTest extends TestCase { 11 12 private static class MyFunction implements UnaryFunction { 13 private boolean gotCallback; 14 15 public void applyTo(Object o) { 16 this.gotCallback = true; 17 } 18 19 public boolean gotCallback() { 20 return this.gotCallback; 21 } 22 } 23 24 public void testSimple() { 25 MyFunction f = new MyFunction(); 26 List l = new ArrayList(); 27 l.add(new Object()); 28 Applier.apply(f, l.iterator()); 29 assertTrue(f.gotCallback()); 30 } 31 }

This page was automatically generated by Maven