use of com.terran4j.commons.api2doc.codewriter.MemoryCodeOutput in project commons by terran4j.
the class JavaBeanCodeWriterTest method testGetModel.
@Test
public void testGetModel() throws Exception {
log.info("testGetModel");
Method method = ReflectionUtils.findMethod(getClass(), "getUser");
KeyedList<String, ApiResultObject> totalResults = new KeyedList<>();
ApiResultObject user = ApiResultObject.parseResultType(method, totalResults);
Map<String, Object> model = javaBeanCodeWriter.getModel(user, "User", null);
@SuppressWarnings("unchecked") Set<String> imports = (Set<String>) model.get("imports");
log.info("imports: {}", imports);
Assert.assertFalse(imports.contains(Date.class.getName()));
MemoryCodeOutput out = new MemoryCodeOutput();
javaBeanCodeWriter.writeCode(user, "User", out, null);
String code = out.getCode("User.java");
log.info("User.java:\n{}", code);
}
Aggregations