### Question:
WSDLValidator { static int executeValidator(String wsdlUrl, PrintStream msg) { try { ToolContext env = new ToolContext(); env.put(ToolConstants.CFG_WSDLURL, wsdlUrl); final WSDL11Validator validator = new WSDL11Validator(null, env); if (validator.isValid()) { return 0; } } catch (ToolException ex) { msg.print(ex.getMessage()); if ((ex.getCause() == null || ex.getCause() == ex) && ex.getMessage().contains(" Failures: 0,")) { return 0; } } catch (Exception ex) { msg.println(ex.getMessage()); } return 1; } private  WSDLValidator(); static void main(String[] args);  }### Answer:
@Test public void shouldFailValidation() { final MockStream bout = new MockStream(); assertEquals(1, WSDLValidator.executeValidator("src/test/resources/error.wsdl", bout)); assertTrue(!bout.isEmpty()); }
@Test public void shouldProduceWarning() { final MockStream bout = new MockStream(); assertEquals(0, WSDLValidator.executeValidator("src/test/resources/warn.wsdl", bout)); assertTrue(!bout.isEmpty()); }
@Test public void shouldProduceError() { final MockStream bout = new MockStream(); assertEquals(1, WSDLValidator.executeValidator("src/test/resources/warnanderror.wsdl", bout)); assertTrue(!bout.isEmpty()); }
@Test public void shouldPassValidation() { final MockStream bout = new MockStream(); assertEquals(0, WSDLValidator.executeValidator("src/test/resources/testservice.wsdl", bout)); assertTrue(bout.isEmpty()); }