use of com.tvd12.ezyhttp.server.core.reflect.ExceptionHandlerMethod in project ezyhttp by youngmonkeys.
the class ExceptionHandlerImplementerTest method test.
@Test
public void test() {
ExceptionHandlerImplementer.setDebug(true);
ExceptionHandlerProxy exceptionHandler = new ExceptionHandlerProxy(new GlobalExceptionHandler());
for (ExceptionHandlerMethod method : exceptionHandler.getExceptionHandlerMethods()) {
ExceptionHandlerImplementer implementer = new ExceptionHandlerImplementer(exceptionHandler, method);
implementer.implement();
}
}
use of com.tvd12.ezyhttp.server.core.reflect.ExceptionHandlerMethod in project ezyhttp by youngmonkeys.
the class ControllerProxyTest method test.
@Test
public void test() {
// given
HomeController homeController = new HomeController();
ControllerProxy sut = new ControllerProxy(homeController);
// when
List<ExceptionHandlerMethod> exceptionHandlerMethods = sut.getExceptionHandlerMethods();
// then
Asserts.assertEquals(2, exceptionHandlerMethods.size());
Asserts.assertFalse(sut.isPayment());
Asserts.assertNull(sut.getFeature());
System.out.println(sut);
}
use of com.tvd12.ezyhttp.server.core.reflect.ExceptionHandlerMethod in project ezyhttp by youngmonkeys.
the class ExceptionHandlersImplementer method implement.
public Map<Class<?>, UncaughtExceptionHandler> implement(Object exceptionHandler) {
Map<Class<?>, UncaughtExceptionHandler> handlers = new HashMap<>();
ExceptionHandlerProxy proxy = new ExceptionHandlerProxy(exceptionHandler);
for (ExceptionHandlerMethod method : proxy.getExceptionHandlerMethods()) {
ExceptionHandlerImplementer implementer = newImplementer(proxy, method);
UncaughtExceptionHandler handler = implementer.implement();
for (Class<?> exceptionClass : method.getExceptionClasses()) {
handlers.put(exceptionClass, handler);
}
}
return handlers;
}
use of com.tvd12.ezyhttp.server.core.reflect.ExceptionHandlerMethod in project ezyhttp by youngmonkeys.
the class ExceptionHandlerImplementerTest method test.
@Test
public void test() {
ExceptionHandlerImplementer.setDebug(true);
ExceptionHandlerProxy exceptionHandler = new ExceptionHandlerProxy(new GlobalExceptionHandler());
for (ExceptionHandlerMethod method : exceptionHandler.getExceptionHandlerMethods()) {
ExceptionHandlerImplementer implementer = new ExceptionHandlerImplementer(exceptionHandler, method);
implementer.implement();
}
}
Aggregations