public void testFaultyWebService_badEndpoint(){
TestLogger.logger.debug("----------------------------------");
TestLogger.logger.debug("test: " + getName());
FaultyWebServiceService service = new FaultyWebServiceService();
FaultyWebServicePortType proxy = service.getFaultyWebServicePort();
String host = "this.is.a.bad.endpoint.terrible.in.fact";
String badEndpoint = "http://" + host;
WebServiceException exception = null;
try{
exception = null;
BindingProvider p = (BindingProvider)proxy;
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,badEndpoint);
// the invoke will throw an exception, if the test is performed right
int total = proxy.faultyWebService(10);
}catch(FaultyWebServiceFault_Exception e) {
// shouldn't get this exception
fail(e.toString());
}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;
BindingProvider p = (BindingProvider)proxy;
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,badEndpoint);
// the invoke will throw an exception, if the test is performed right
int total = proxy.faultyWebService(10);
}catch(FaultyWebServiceFault_Exception e) {
// shouldn't get this exception
fail(e.toString());
}catch(WebServiceException e) {