use of io.leopard.topnb.methodtime.MethodTimeInterceptor in project leopard by tanhaichao.
the class TopnbInterceptorTest method invoke.
// @Test
// public void getContext() {
// Assert.assertNotNull(TopnbInterceptor.getContext("applicationContext.xml"));
// Assert.assertNotNull(TopnbInterceptor.getContext("applicationContext.xml", false));
// Assert.assertNotNull(TopnbInterceptor.getContext("applicationContext.xml", true));
// }
@Test
public void invoke() throws Throwable {
MethodInvocation invocation = new MethodInvocation() {
@Override
public Object[] getArguments() {
return null;
}
@Override
public AccessibleObject getStaticPart() {
return null;
}
@Override
public Object getThis() {
return TopnbInterceptorTest.this;
}
@Override
public Object proceed() throws Throwable {
return "ok";
}
@Override
public Method getMethod() {
try {
return TopnbInterceptorTest.class.getMethod("invoke");
} catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
}
}
};
Object result = new MethodTimeInterceptor().invoke(invocation);
Assert.assertEquals("ok", result);
}
Aggregations