public void testFaultyWebService_badEndpoint_oneWay() {
String host = "this.is.a.bad.endpoint.terrible.in.fact";
String badEndpoint = "http://" + host;
DocLitWrapService service = new DocLitWrapService();
DocLitWrap proxy = service.getDocLitWrapPort();
BindingProvider p = (BindingProvider)proxy;
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,badEndpoint);
WebServiceException exception = null;
TestLogger.logger.debug("------------------------------");
TestLogger.logger.debug("Test : " + getName());
try{
exception = null;
proxy.oneWayVoid();
}catch(WebServiceException e) {
exception = e;
}catch(Exception e) {
fail("This testcase should only produce a WebServiceException. We got: " + e.toString());
}
TestLogger.logger.debug("----------------------------------");
assertNotNull(exception);
assertTrue(exception.getCause() instanceof UnknownHostException);
assertTrue(exception.getCause().getMessage().indexOf(host)!=-1);
// Repeat to verify behavior
try{
exception = null;
proxy.oneWayVoid();
}catch(WebServiceException e) {
exception = e;
}catch(Exception e) {
fail("This testcase should only produce a WebServiceException. We got: " + e.toString());