1 package test.net.sourceforge.pmd.jaxen;
2
3 import junit.framework.TestCase;
4 import net.sourceforge.pmd.ast.SimpleNode;
5 import net.sourceforge.pmd.jaxen.Attribute;
6 import net.sourceforge.pmd.jaxen.AttributeAxisIterator;
7
8 public class AttributeAxisIteratorTest extends TestCase {
9
10 public void testRemove() {
11 SimpleNode n = new SimpleNode(0);
12 n.testingOnly__setBeginColumn(1);
13 n.testingOnly__setBeginLine(1);
14 AttributeAxisIterator iter = new AttributeAxisIterator(n);
15 try {
16 iter.remove();
17 fail("Should have thrown an exception!");
18 } catch (UnsupportedOperationException e) {
19 // cool
20 }
21 }
22
23 public void testNext() {
24 SimpleNode n = new SimpleNode(0);
25 n.testingOnly__setBeginLine(1);
26 n.testingOnly__setBeginColumn(2);
27 AttributeAxisIterator iter = new AttributeAxisIterator(n);
28 Attribute a = (Attribute)iter.next();
29 assertEquals("BeginLine", a.getName());
30 assertEquals("1", a.getValue());
31 a = (Attribute)iter.next();
32 assertEquals("BeginColumn", a.getName());
33 assertEquals("2", a.getValue());
34 a = (Attribute)iter.next();
35 assertEquals("EndLine", a.getName());
36 assertEquals("0", a.getValue());
37 a = (Attribute)iter.next();
38 assertEquals("EndColumn", a.getName());
39 assertFalse(iter.hasNext());
40 }
41 }
This page was automatically generated by Maven