use of com.terran4j.commons.api2doc.domain.ApiResultObject in project commons by terran4j.
the class ParseListBeanTest method testParseListBean.
@Test
public void testParseListBean() throws Exception {
log.info("testParseListBean");
Method method = ReflectionUtils.findMethod(getClass(), "getListBean");
Assert.assertNotNull(method);
KeyedList<String, ApiResultObject> list = new KeyedList<>();
ApiResultObject results = ApiResultObject.parseResultType(method, list);
Assert.assertNotNull(results);
log.info("results: {}", results);
Assert.assertTrue(list.size() == 2);
ApiResultObject resultTop = list.get(0);
log.info("resultTop: {}", resultTop);
Assert.assertTrue(resultTop.getChildren().size() == 1);
ApiResultObject users = resultTop.getChildren().get(0);
Assert.assertEquals("users", users.getId());
Assert.assertEquals("There are many users!", users.getComment().getValue());
ApiResultObject resultUser = list.get(1);
log.info("resultUser: {}", resultUser);
Assert.assertEquals("users", resultUser.getId());
Assert.assertTrue(resultUser.getChildren().size() == 2);
ApiResultObject userId = resultUser.getChildren().get(0);
Assert.assertEquals("id", userId.getId());
Assert.assertEquals("账号id", userId.getComment().getValue());
}
use of com.terran4j.commons.api2doc.domain.ApiResultObject in project commons by terran4j.
the class ParseListBeanTest method testGetSourceType.
@Test
public void testGetSourceType() throws Exception {
log.info("testGetSourceType");
Method method = ReflectionUtils.findMethod(getClass(), "getListBean");
ApiResultObject results = ApiResultObject.parseResultType(method, new KeyedList<>());
Assert.assertNotNull(results);
log.info("results: {}", results);
Assert.assertTrue(results.getChildren().size() == 1);
ApiResultObject user = results.getChildren().get(0);
Assert.assertEquals(User.class, user.getSourceType());
}
Aggregations