From 64ec56073eec736ee01d1bc69b9a7f26f10c6423 Mon Sep 17 00:00:00 2001 From: snoop Date: Wed, 28 Jun 2017 21:13:28 +0900 Subject: [PATCH] added test --- .../service/TargetDiscoveryServiceTest.java | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/src/test/java/com/loafle/overflow/module/target/service/TargetDiscoveryServiceTest.java b/src/test/java/com/loafle/overflow/module/target/service/TargetDiscoveryServiceTest.java index fd84fc2..5a8a603 100644 --- a/src/test/java/com/loafle/overflow/module/target/service/TargetDiscoveryServiceTest.java +++ b/src/test/java/com/loafle/overflow/module/target/service/TargetDiscoveryServiceTest.java @@ -9,6 +9,8 @@ import org.codehaus.jackson.map.ObjectMapper; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; +import org.springframework.aop.framework.Advised; +import org.springframework.aop.support.AopUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.io.ResourceLoader; import org.springframework.test.context.ContextConfiguration; @@ -17,12 +19,16 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; +import java.lang.reflect.Method; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Proxy; +import java.lang.reflect.Type; import java.util.List; /** * Created by snoop on 17. 6. 28. */ -@Ignore + @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class}) public class TargetDiscoveryServiceTest { @@ -62,6 +68,44 @@ public class TargetDiscoveryServiceTest { } reader.close(); return fileData.toString(); + } + + + @Test + public void testParam() throws NoSuchMethodException { + + Method m = this.targetDiscoveryService.getClass().getMethod("saveAllTarget", List.class, Probe.class); +// Method m = TargetDiscoveryService.class.getMethod("saveAllTarget", List.class, Probe.class); + + System.out.println(m.getName()); + Type[] genericParameterTypes = m.getGenericParameterTypes(); + + for(Type genericParameterType : genericParameterTypes){ + if(genericParameterType instanceof ParameterizedType){ + ParameterizedType aType = (ParameterizedType) genericParameterType; + Type[] parameterArgTypes = aType.getActualTypeArguments(); + for(Type parameterArgType : parameterArgTypes){ + Class parameterArgClass = (Class) parameterArgType; + System.out.println("parameterArgClass = " + parameterArgClass); + } + } + } + } + + + @Test + public void testName() throws ClassNotFoundException { + + Object o = this.targetDiscoveryService; + + String nnn = o.getClass().getSimpleName(); + System.out.println(nnn); + + + + + + } } \ No newline at end of file