added
test
This commit is contained in:
parent
14f3adfcc5
commit
04a854eddc
|
@ -34,22 +34,7 @@ public class DBProxyTest {
|
|||
@Autowired
|
||||
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
|
||||
public void RelfectMethod() throws InvocationTargetException, IllegalAccessException {
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user