use of com.tvd12.ezyhttp.server.core.reflect.ControllerProxy in project ezyfox-server by youngmonkeys.
the class EzyRequestControllerTest method test.
@Test
public void test() {
Object instance = new HelloController();
EzyRequestControllerProxy controllerProxy = new EzyRequestControllerProxy(instance);
assert controllerProxy.getInstance() == instance;
// noinspection ConstantConditions
assert controllerProxy.getExceptionHandlerMethods().size() >= 0;
System.out.println(controllerProxy);
}
use of com.tvd12.ezyhttp.server.core.reflect.ControllerProxy in project ezyhttp by youngmonkeys.
the class ControllerProxyTest method isManagementTest.
@Test
public void isManagementTest() {
// given
ControllerProxy sut = new ControllerProxy(new InternalController());
// when
// then
Asserts.assertTrue(sut.isManagement());
}
use of com.tvd12.ezyhttp.server.core.reflect.ControllerProxy in project ezyhttp by youngmonkeys.
the class RequestHandlerImplementerTest method test.
@Test
public void test() {
RequestHandlerImplementer.setDebug(true);
ControllerProxy homeController = new ControllerProxy(new HomeController());
for (RequestHandlerMethod method : homeController.getRequestHandlerMethods()) {
RequestHandlerImplementer implementer = new RequestHandlerImplementer(homeController, method);
implementer.implement();
}
}
use of com.tvd12.ezyhttp.server.core.reflect.ControllerProxy in project ezyhttp by youngmonkeys.
the class RequestHandlerImplementerTest method implementOneFailed.
@Test
public void implementOneFailed() throws Exception {
// given
ControllerProxy controller = new ControllerProxy(new Controller());
RequestHandlerMethod handlerMethod = new RequestHandlerMethod("/", new EzyMethod(Controller.class.getDeclaredMethod("doGet")));
RequestHandlerImplementer sut = new RequestHandlerImplementer(controller, handlerMethod);
// when
Throwable e = Asserts.assertThrows(sut::implement);
// then
Asserts.assertEquals(0, handlerMethod.getParameterTypes().length);
Asserts.assertThat(e).isEqualsType(IllegalStateException.class);
}
use of com.tvd12.ezyhttp.server.core.reflect.ControllerProxy in project ezyhttp by youngmonkeys.
the class ControllerProxyTest method test.
@Test
public void test() {
ControllerProxy home = new ControllerProxy(new HomeController());
System.out.println(home);
}
Aggregations