1 package org.jaxen.javabean; 2 3 import java.util.List ; 4 5 import junit.framework.TestCase; 6 7 import org.jaxen.JaxenException; 8 import org.jaxen.saxpath.helpers.XPathReaderFactory; 9 10 public class DocumentNavigatorTest 11 extends TestCase 12 { 13 14 protected void setUp() throws Exception 15 { 16 System.setProperty( XPathReaderFactory.DRIVER_PROPERTY, 17 "" ); 18 } 19 20 public void testSomething() throws JaxenException { 21 22 JavaBeanXPath xpath = new JavaBeanXPath( "brother[position()<4]/name" ); 25 26 Person bob = new Person( "bob", 30 ); 27 28 bob.addBrother( new Person( "billy", 34 ) ); 29 bob.addBrother( new Person( "seth", 29 ) ); 30 bob.addBrother( new Person( "dave", 32 ) ); 31 bob.addBrother( new Person( "jim", 29 ) ); 32 bob.addBrother( new Person( "larry", 42 ) ); 33 bob.addBrother( new Person( "ted", 22 ) ); 34 35 List result = (List ) xpath.evaluate( bob ); 36 assertEquals(3, result.size()); 37 38 } 39 40 } 41 | Popular Tags |