Source:
public void testGenerateSimpleTypedefStruct() throws IOException, ParserException, TypeRenamingConflictException, ResponseTypeNotFoundException, ParseException, TemplateModelException { final TestFileUtilsImpl fileUtils = new TestFileUtilsImpl(); Map<String,Object> testMap = new HashMap<>(); final Struct structEntry = new Struct("ds3_bucket_response", null, ImmutableList.of( new StructMember( new PrimitiveType("ds3_str*", false), "creation_date"), new StructMember( new PrimitiveType("ds3_str*", false), "data_policy_id"), new StructMember( new PrimitiveType("ds3_str*", false), "id"), new StructMember( new PrimitiveType("uint64_t", false), "last_preferred_chunk_size_in_bytes"), new StructMember( new PrimitiveType("uint64_t", false), "logical_used_capacity"), new StructMember( new PrimitiveType("ds3_str*", false), "name"), new StructMember( new PrimitiveType("ds3_str*", false), "user_id") ), true); testMap.put("structEntry", structEntry); final CCodeGenerator codeGenerator = new CCodeGenerator(); codeGenerator.processTemplate(testMap, "header-templates/TypedefStruct.ftl", fileUtils.getOutputStream()); final ByteArrayOutputStream bstream = (ByteArrayOutputStream) fileUtils.getOutputStream(); final String output = new String(bstream.toByteArray()); final String expectedOutput = "typedef struct {" + "\n" + " ds3_str* creation_date;" + "\n" + " ds3_str* data_policy_id;" + "\n" + " ds3_str* id;" + "\n" + " uint64_t last_preferred_chunk_size_in_bytes;" + "\n" + " uint64_t logical_used_capacity;" + "\n" + " ds3_str* name;" + "\n" + " ds3_str* user_id;" + "\n" + "}ds3_bucket_response;" + "\n"; assertEquals(expectedOutput, output); }

Target:
public void testGenerateSimpleTypedefStruct() throws IOException, ParserException, TypeRenamingConflictException, ResponseTypeNotFoundException, ParseException, TemplateModelException { final TestFileUtilsImpl fileUtils = new TestFileUtilsImpl(); final Map<String,Object> testMap = new HashMap<>(); final Struct structEntry = new Struct("ds3_bucket_response", null, ImmutableList.of( new StructMember( new PrimitiveType("ds3_str*", false), "creation_date"), new StructMember( new PrimitiveType("ds3_str*", false), "data_policy_id"), new StructMember( new PrimitiveType("ds3_str*", false), "id"), new StructMember( new PrimitiveType("uint64_t", false), "last_preferred_chunk_size_in_bytes"), new StructMember( new PrimitiveType("uint64_t", false), "logical_used_capacity"), new StructMember( new PrimitiveType("ds3_str*", false), "name"), new StructMember( new PrimitiveType("ds3_str*", false), "user_id") ), true); testMap.put("structEntry", structEntry); final CCodeGenerator codeGenerator = new CCodeGenerator(); codeGenerator.processTemplate(testMap, "header-templates/TypedefStruct.ftl", fileUtils.getOutputStream()); final ByteArrayOutputStream bstream = (ByteArrayOutputStream) fileUtils.getOutputStream(); final String output = new String(bstream.toByteArray()); final String expectedOutput = "typedef struct {" + "\n" + " ds3_str* creation_date;" + "\n" + " ds3_str* data_policy_id;" + "\n" + " ds3_str* id;" + "\n" + " uint64_t last_preferred_chunk_size_in_bytes;" + "\n" + " uint64_t logical_used_capacity;" + "\n" + " ds3_str* name;" + "\n" + " ds3_str* user_id;" + "\n" + "}ds3_bucket_response;" + "\n"; assertEquals(expectedOutput, output); }