test
This commit is contained in:
snoop 2017-06-23 20:31:33 +09:00
parent 14f3adfcc5
commit 04a854eddc
2 changed files with 67 additions and 15 deletions

View File

@ -34,22 +34,7 @@ public class DBProxyTest {
@Autowired @Autowired
private NoAuthProbeDAO noAuthProbeDAO; private NoAuthProbeDAO noAuthProbeDAO;
@Test
public void RelfetMehotds() {
JpaRepository jpa = this.noAuthProbeDAO;
Method[] mArray = jpa.getClass().getMethods();
for (Method m : mArray) {
if( m.getName().equals("findOne")) {
System.out.println(m.getParameterTypes());
}
}
}
@Test @Test
public void RelfectMethod() throws InvocationTargetException, IllegalAccessException { public void RelfectMethod() throws InvocationTargetException, IllegalAccessException {

View File

@ -0,0 +1,67 @@
package com.loafle.overflow.proxy.db;
import com.loafle.overflow.AppConfig;
import com.loafle.overflow.JdbcConfiguration;
import com.loafle.overflow.module.domain.model.Domain;
import com.loafle.overflow.module.noauthprobe.dao.NoAuthProbeDAO;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.lang.reflect.Method;
import static org.junit.Assert.*;
/**
* Created by root on 17. 6. 23.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class})
public class MethodSeekerTest {
@Autowired
private NoAuthProbeDAO noAuthProbeDAO;
@Test
public void getMethod() throws Exception {
JpaRepository jpa = this.noAuthProbeDAO;
Method m = MethodSeeker.getMethod(jpa.getClass(), "findAllByDomain", null);
Assert.assertNotEquals(m, null);
}
@Test
public void RelfetMehotds() {
JpaRepository jpa = this.noAuthProbeDAO;
Method[] mArray = jpa.getClass().getMethods();
for (Method m : mArray) {
if( m.getName().equals("findAllByDomain")) {
System.out.println(m.getParameterTypes());
}
}
}
@Test
public void RelfectMethodType() throws NoSuchMethodException {
JpaRepository jpa = this.noAuthProbeDAO;
Method m = jpa.getClass().getMethod("findAllByDomain", Domain.class);
Assert.assertNotEquals(m, null);
}
}