### Question:
ToolspecValidator { public void validate() throws GeneratorException { if (toolspec == null) { throw new GeneratorException("Tool specification is not available"); } List<Service> services = toolspec.getServices().getService(); for (Service service : services) { validateService(service, toolspec.getVersion()); } } ToolspecValidator(Toolspec toolspec, Configuration ioc); void validateWithXMLSchema(); void validate(); boolean isValid(); void checkpoint(); void addError(Error err);  }### Answer:
@Test public void testValidateError2() { try { Configuration ioc = new Configuration(); URL url = this.getClass().getResource("/Errortoolspec.xml"); File testXml = new File(url.getFile()); ioc.setXmlConf(testXml); ioc.setProjConf(new File(Constants.DEFAULT_PROJECT_PROPERTIES)); Toolspec toolspec = null; ToolspecValidator tv = new ToolspecValidator(toolspec, ioc); Toolspec pru = new Toolspec(); pru.setServices(new Services()); tv.validate(); fail("Should raise exception"); } catch (GeneratorException ex) { } }
@Test public void testValidate() throws Exception { for (String toolspec : toolspecs) { ToolspecValidator tv = getToolspecValidator(toolspec); tv.validateWithXMLSchema(); tv.validate(); tv.isValid(); } }