Commit 5d9bde65fd222225452760f781826ed20e7f4c60

Authored by Ednara Oliveira
1 parent 67b2e6e4
Exists in master

Refatoração de teste unitário: ReflectionsTest

impl/core/src/test/java/br/gov/frameworkdemoiselle/util/ReflectionsTest.java
... ... @@ -38,21 +38,42 @@ package br.gov.frameworkdemoiselle.util;
38 38  
39 39 import static org.junit.Assert.assertEquals;
40 40  
  41 +import java.lang.reflect.Field;
  42 +import java.lang.reflect.Member;
  43 +import java.lang.reflect.Method;
  44 +import java.util.logging.Logger;
  45 +
41 46 import org.junit.Test;
42 47  
43 48 public class ReflectionsTest {
44 49  
  50 + private String text;
  51 +
45 52 @Test
46 53 public void testGetGenericTypeArgumentClass() {
47 54 assertEquals(Long.class, Reflections.getGenericTypeArgument(OtherClass.class, 0));
48 55 assertEquals(String.class, Reflections.getGenericTypeArgument(OtherClass.class, 1));
49 56 }
50 57  
  58 + @Test
  59 + public void testGetGenericTypeArgumentMember() throws SecurityException, NoSuchFieldException {
  60 + Member[] members = OtherClass.class.getFields();
  61 + assertEquals(Long.class, Reflections.getGenericTypeArgument(members[0], 0));
  62 + assertEquals(String.class, Reflections.getGenericTypeArgument(members[1], 0));
  63 + }
51 64 }
52 65  
53 66 class SomeClass<T, I> {
54 67  
  68 + public void setNumber(T t) {
  69 +
  70 + }
55 71 }
56 72  
57 73 class OtherClass extends SomeClass<Long, String> {
  74 +
  75 + public Class<Long> number;
  76 +
  77 +
  78 + public Class<String> text;
58 79 }
... ...