WordTemplateBuilder implements TemplateBuilder<E> { public Template<E> build() throws TemplateBuildException { validateBeforeBuild(); TemplateDataImpl<E> template = new TemplateDataImpl<>(); template.setDocumentName(documentName); template.setLanguage(language); template.setInputType(inputType); template.setProperties(modelProperties); template.setEditor(user); template.setContentMapping(mappingData); template.setContent(getContent(),user); Date date = new Date(); template.setEditedAt(date); template.setCreatedAt(date); return new WordTemplate<E>(template, contextFactory); } WordTemplateBuilder(TemplateContextFactory contextFactory,
			WteModelService service, Class<E> inputType); @Override TemplateBuilder<E> setProperties(Map<String, String> modelProperties); @Override TemplateBuilder<E> setDocumentName(String documentName); @Override TemplateBuilder<E> setAuthor(User user); @Override TemplateBuilder<E> setLanguage(String language); @Override TemplateBuilder<E> setMappingData(Map<String, MappingDetail> mappingData); @Override TemplateBuilder<E> setTemplateFile(Path aTemplateFile); Template<E> build();  }
@Test(expected = TemplateBuildException.class) public void testRequiredPropertiesMissing() { requiredProperties.add("test"); TemplateContextFactory contextFactory = mock(TemplateContextFactory.class); WordTemplateBuilder<String> wtb = new WordTemplateBuilder<String>(contextFactory, new SimpleValueModelService(), String.class); wtb.build(); fail("Exception expected"); }