Search in sources :

Example 6 with EzyExceptionHandlerMethod

use of com.tvd12.ezyfoxserver.support.reflect.EzyExceptionHandlerMethod in project ezyfox-server by youngmonkeys.

the class EzyExceptionHandlerImplementerTest method testFailedCase.

@Test(expectedExceptions = IllegalStateException.class)
public void testFailedCase() throws Exception {
    EzyExceptionHandlerProxy handlerProxy = new EzyExceptionHandlerProxy(new ExceptionHandlerFail());
    EzyExceptionHandlerMethod method = new EzyExceptionHandlerMethod(new EzyMethod(ExceptionHandlerFail.class.getDeclaredMethod("handle", Exception.class, int.class)));
    new EzyExceptionHandlerImplementer(handlerProxy, method) {

        @SuppressWarnings("rawtypes")
        @Override
        protected EzyUncaughtExceptionHandler doImplement() {
            throw new IllegalStateException("test");
        }
    }.implement();
}
Also used : EzyExceptionHandlerImplementer(com.tvd12.ezyfoxserver.support.asm.EzyExceptionHandlerImplementer) EzyExceptionHandlerProxy(com.tvd12.ezyfoxserver.support.reflect.EzyExceptionHandlerProxy) EzyExceptionHandlerMethod(com.tvd12.ezyfoxserver.support.reflect.EzyExceptionHandlerMethod) EzyUncaughtExceptionHandler(com.tvd12.ezyfoxserver.support.handler.EzyUncaughtExceptionHandler) EzyMethod(com.tvd12.ezyfox.reflect.EzyMethod) Test(org.testng.annotations.Test)

Aggregations

EzyMethod (com.tvd12.ezyfox.reflect.EzyMethod)4 EzyExceptionHandlerMethod (com.tvd12.ezyfoxserver.support.reflect.EzyExceptionHandlerMethod)3 EzyTryCatch (com.tvd12.ezyfox.core.annotation.EzyTryCatch)2 EzyUncaughtExceptionHandler (com.tvd12.ezyfoxserver.support.handler.EzyUncaughtExceptionHandler)2 EzyExceptionHandlerProxy (com.tvd12.ezyfoxserver.support.reflect.EzyExceptionHandlerProxy)2 ArrayList (java.util.ArrayList)2 EzyFunction (com.tvd12.ezyfox.asm.EzyFunction)1 EzyBody (com.tvd12.ezyfox.asm.EzyFunction.EzyBody)1 EzyInstruction (com.tvd12.ezyfox.asm.EzyInstruction)1 EzyClass (com.tvd12.ezyfox.reflect.EzyClass)1 EzyClassTree (com.tvd12.ezyfox.reflect.EzyClassTree)1 EzyContext (com.tvd12.ezyfoxserver.context.EzyContext)1 EzyUser (com.tvd12.ezyfoxserver.entity.EzyUser)1 EzyExceptionHandlerImplementer (com.tvd12.ezyfoxserver.support.asm.EzyExceptionHandlerImplementer)1 Parameter (java.lang.reflect.Parameter)1 HashMap (java.util.HashMap)1 CtClass (javassist.CtClass)1 Test (org.testng.annotations.Test)1