use of core.framework.impl.web.response.ResponseImpl in project core-ng-project by neowu.
the class WebServiceControllerBuilderTest method get.
@Test
void get() throws Exception {
when(request.pathParam("id", Integer.class)).thenReturn(1);
WebServiceControllerBuilder<TestWebService> builder = new WebServiceControllerBuilder<>(TestWebService.class, serviceImpl, TestWebService.class.getDeclaredMethod("get", Integer.class));
Controller controller = builder.build();
String sourceCode = builder.builder.sourceCode();
assertEquals(ClasspathResources.text("webservice-test/test-webservice-controller-get.java"), sourceCode);
Response response = controller.execute(request);
assertEquals(HTTPStatus.OK, response.status());
@SuppressWarnings("unchecked") Optional<TestWebService.TestResponse> bean = (Optional<TestWebService.TestResponse>) ((BeanBody) ((ResponseImpl) response).body).bean;
assertEquals(2, (int) bean.get().intField);
}
Aggregations