Exemplo n.º 1
0
 @Test
 public void testPrimitivesArrays1() throws NoSuchMethodException {
   Method m = ReflectUtil.findDeclaredMethod(Foo.class, "primarr1");
   MethodParameter[] mps = Paramo.resolveParameters(m);
   String[] s = resolveParameterNames(mps);
   assertEquals(2, s.length);
   assertEquals("one", s[0]);
   assertEquals("two", s[1]);
 }
Exemplo n.º 2
0
  @Test
  public void testGeneric() {
    Method m = ReflectUtil.findDeclaredMethod(Generic.class, "one");
    MethodParameter[] mps = Paramo.resolveParameters(m);
    assertEquals(2, mps.length);
    assertEquals("foo", mps[0].getName());
    assertEquals("Ljava/util/Map<Ljava/lang/String;Ljava/lang/Long;>;", mps[0].getSignature());
    assertEquals("aLong", mps[1].getName());
    assertEquals("Ljava/lang/Long;", mps[1].getSignature());

    m = ReflectUtil.findDeclaredMethod(Generic.class, "two");
    mps = Paramo.resolveParameters(m);
    assertEquals(1, mps.length);
    assertEquals("zzz", mps[0].getName());
    assertEquals(
        "Ljava/util/Map<Ljava/lang/String;Ljodd/paramo/data/Bar<Ljava/lang/Long;>;>;",
        mps[0].getSignature());
  }
Exemplo n.º 3
0
 @Test
 public void testPrimitivesArrays3() throws NoSuchMethodException {
   Method m = ReflectUtil.findDeclaredMethod(Foo.class, "primarrShortByte");
   MethodParameter[] mps = Paramo.resolveParameters(m);
   String[] s = resolveParameterNames(mps);
   assertEquals(3, s.length);
   assertEquals("s", s[0]);
   assertEquals("y", s[1]);
   assertEquals("somethingElse", s[2]);
 }
Exemplo n.º 4
0
 @Test
 public void testNonGeneric() {
   Method m = ReflectUtil.findDeclaredMethod(NonGeneric.class, "one");
   MethodParameter[] mps = Paramo.resolveParameters(m);
   assertEquals(2, mps.length);
   assertEquals("foo", mps[0].getName());
   assertEquals("Ljava/util/Map;", mps[0].getSignature());
   assertEquals("aLong", mps[1].getName());
   assertEquals("Ljava/lang/Long;", mps[1].getSignature());
 }
Exemplo n.º 5
0
 @Test
 public void testPrimitivesArrays2() throws NoSuchMethodException {
   Method m = ReflectUtil.findDeclaredMethod(Foo.class, "primarr2");
   MethodParameter[] mps = Paramo.resolveParameters(m);
   String[] s = resolveParameterNames(mps);
   assertEquals(6, s.length);
   assertEquals("i", s[0]);
   assertEquals("l", s[1]);
   assertEquals("f", s[2]);
   assertEquals("d", s[3]);
   assertEquals("b", s[4]);
   assertEquals("c", s[5]);
 }