### Question:
WsdlCreator { public void insertDataTypes() throws GeneratorException { try { File wsdlTemplate = new File(this.wsdlSourcePath); if (!wsdlTemplate.canRead()) { throw new GeneratorException("Unable to read WSDL Template file: " + this.wsdlSourcePath); } DocumentBuilderFactory docBuildFact = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docBuildFact.newDocumentBuilder(); doc = docBuilder.parse(this.wsdlSourcePath); for (Operation operation : operations) { createMessageDataTypes(operation); createSchemaDataTypes(operation); createOperation(doc, operation); createBinding(doc, operation); } Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.ENCODING, "utf-8"); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{http: DOMSource source = new DOMSource(doc); FileOutputStream fos = new FileOutputStream(this.wsdlTargetPath); StreamResult result = new StreamResult(fos); transformer.transform(source, result); fos.close(); if(!((new File(wsdlTargetPath)).exists())) { throw new GeneratorException("WSDL file has not been created successfully."); } } catch (Exception ex) { throw new GeneratorException("An exception occurred: " + ex.getMessage()); } } WsdlCreator(PropertiesSubstitutor st, String wsdlSourcePath, String wsdlTargetAbsPath, List<Operation> operations); void insertDataTypes();  }### Answer:
@Test public void testMultipleAtribute() throws GeneratorException, IOException { ioc = new Configuration(); URL url = this.getClass().getResource("/finereader.xml"); File testXml = new File(url.getFile()); ioc.setXmlConf(testXml); url = this.getClass().getResource("/toolwrapper.properties"); File testProjConf = new File(url.getFile()); ioc.setProjConf(testProjConf); st = new PropertiesSubstitutor(ioc.getProjConf()); JAXBContext context; try { context = JAXBContext .newInstance("eu.impact_project.iif.tw.toolspec"); Unmarshaller unmarshaller = context.createUnmarshaller(); Toolspec toolspec = (Toolspec) unmarshaller.unmarshal(new File(ioc .getXmlConf())); List<Service> services = toolspec.getServices().getService(); for (Service service : services) { PropertiesSubstitutor st = new PropertiesSubstitutor(ioc.getProjConf()); ServiceDef sdef = new ServiceDef(service.getName(), toolspec.getVersion()); st.setServiceDef(sdef); st.addVariable("tool_version", sdef.getVersion()); st.addVariable("project_title", sdef.getName()); st.addVariable("global_package_name", service.getServicepackage()); String cpp = service.getContextpathprefix(); st.addVariable("contextpath_prefix", ((cpp == null) ? "" : cpp)); st.deriveVariables(); File dir = new File(st.getTemplateDir()); st.processDirectory(dir); String generatedDir = st.getGenerateDir(); String projMidfix = st.getProjectMidfix(); String projDir = st.getProjectDirectory(); String wsdlSourcePath = FileUtil.makePath("tmpl") + "Template.wsdl"; String wsdlTargetPath = FileUtil.makePath(generatedDir, projDir, "src", "main", "webapp") + projMidfix + ".wsdl"; List<Operation> operations = service.getOperations().getOperation(); WsdlCreator wsdlCreator = new WsdlCreator(st, wsdlSourcePath, wsdlTargetPath, operations); wsdlCreator.insertDataTypes(); } } catch (JAXBException ex) { throw new GeneratorException( "Unable to create XML binding for toolspec"); } }
@Test public void testInsertDataTypesException() { WsdlCreator instance = new WsdlCreator(null, null, null, null); try { instance.insertDataTypes(); fail("Should raise exception"); } catch (GeneratorException ex) { } }