    1   /***
    2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
    3    */
    4   package test.net.sourceforge.pmd.jaxen;
    5
    6   import junit.framework.TestCase;
    7   import net.sourceforge.pmd.ast.ASTPrimaryPrefix;
    8   import net.sourceforge.pmd.jaxen.Attribute;
    9
    10  import java.lang.reflect.Method;
    11
    12  public class AttributeTest extends TestCase {
    13
    14      public void testConstructor() {
    15          ASTPrimaryPrefix p = new ASTPrimaryPrefix(1);
    16          p.testingOnly__setBeginLine(5);
    17          Method[] methods = p.getClass().getMethods();
    18          Method m = null;
    19          for (int i = 0; i < methods.length; i++) {
    20              if (methods[i].getName().equals("getBeginLine")) {
    21                  m = methods[i];
    22                  break;
    23              }
    24          }
    25          Attribute a = new Attribute(p, "BeginLine", m);
    26          assertEquals("BeginLine", a.getName());
    27          assertEquals("5", a.getValue());
    28          assertEquals(p, a.getParent());
    29      }
    30  }