public void testMethodParameterNameDiscoveryWithArgs() throws NoSuchMethodException {
   Method setName = TestBean.class.getMethod("setName", new Class[] {String.class});
   String[] names = discoverer.getParameterNames(setName);
   assertNotNull("should find method info", names);
   assertEquals("one argument", 1, names.length);
   assertEquals("name", names[0]);
 }
  public void testOverloadedStaticMethodInInnerClass() throws Exception {
    Class clazz = InnerClass.class;

    Method m1 = clazz.getMethod("staticMethod", new Class[] {Long.TYPE});
    String[] names = discoverer.getParameterNames(m1);
    assertNotNull("should find method info", names);
    assertEquals("one argument", 1, names.length);
    assertEquals("x", names[0]);

    Method m2 = clazz.getMethod("staticMethod", new Class[] {Long.TYPE, Long.TYPE});
    names = discoverer.getParameterNames(m2);
    assertNotNull("should find method info", names);
    assertEquals("two arguments", 2, names.length);
    assertEquals("x", names[0]);
    assertEquals("y", names[1]);
  }
 public void testConsParameterNameDiscoveryArgs() throws NoSuchMethodException {
   Constructor twoArgCons = TestBean.class.getConstructor(new Class[] {String.class, int.class});
   String[] names = discoverer.getParameterNames(twoArgCons);
   assertNotNull("should find cons info", names);
   assertEquals("one argument", 2, names.length);
   assertEquals("name", names[0]);
   assertEquals("age", names[1]);
 }
  public void testOverloadedMethod() throws Exception {
    Class clazz = this.getClass();

    Method m1 = clazz.getMethod("instanceMethod", new Class[] {Double.TYPE, Double.TYPE});
    String[] names = discoverer.getParameterNames(m1);
    assertNotNull("should find method info", names);
    assertEquals("two arguments", 2, names.length);
    assertEquals("x", names[0]);
    assertEquals("y", names[1]);

    Method m2 =
        clazz.getMethod("instanceMethod", new Class[] {Double.TYPE, Double.TYPE, Double.TYPE});
    names = discoverer.getParameterNames(m2);
    assertNotNull("should find method info", names);
    assertEquals("three arguments", 3, names.length);
    assertEquals("x", names[0]);
    assertEquals("y", names[1]);
    assertEquals("z", names[2]);
  }
 public void testStaticMethodParameterNameDiscoveryNoArgs() throws NoSuchMethodException {
   Method m = getClass().getMethod("staticMethodNoLocalVars", new Class[0]);
   String[] names = discoverer.getParameterNames(m);
   assertNotNull("should find method info", names);
   assertEquals("no argument names", 0, names.length);
 }
 public void testConsParameterNameDiscoveryNoArgs() throws NoSuchMethodException {
   Constructor noArgsCons = TestBean.class.getConstructor(new Class[0]);
   String[] names = discoverer.getParameterNames(noArgsCons);
   assertNotNull("should find cons info", names);
   assertEquals("no argument names", 0, names.length);
 }
 public void testMethodParameterNameDiscoveryNoArgs() throws NoSuchMethodException {
   Method getName = TestBean.class.getMethod("getName", new Class[0]);
   String[] names = discoverer.getParameterNames(getName);
   assertNotNull("should find method info", names);
   assertEquals("no argument names", 0, names.length);
 }