TestLogger.logger.debug("----------------------------------");
TestLogger.logger.debug("test: " + getName());
FaultyWebServiceService service = new FaultyWebServiceService();
FaultyWebServicePortType proxy = service.getFaultyWebServicePort();
FaultyWebServiceFault_Exception exception = null;
try{
exception = null;
BindingProvider p = (BindingProvider)proxy;
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,axisEndpoint);
// the invoke will throw an exception, if the test is performed right
int total = proxy.faultyWebService(10);
}catch(FaultyWebServiceFault_Exception e){
exception = e;
}catch(Exception e) {
e.printStackTrace();
fail(e.toString());
}
TestLogger.logger.debug("----------------------------------");
assertNotNull(exception);
assertEquals("custom exception", exception.getMessage());
assertNotNull(exception.getFaultInfo());
assertEquals("bean custom fault info", exception.getFaultInfo().getFaultInfo());
assertEquals("bean custom message", exception.getFaultInfo().getMessage());
// Repeat to verify behavior
try{
exception = null;
BindingProvider p = (BindingProvider)proxy;
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,axisEndpoint);
// the invoke will throw an exception, if the test is performed right
int total = proxy.faultyWebService(10);
}catch(FaultyWebServiceFault_Exception e){
exception = e;
}catch(Exception e) {
e.printStackTrace();
fail(e.toString());
}
TestLogger.logger.debug("----------------------------------");
assertNotNull(exception);
assertEquals("custom exception", exception.getMessage());
assertNotNull(exception.getFaultInfo());
assertEquals("bean custom fault info", exception.getFaultInfo().getFaultInfo());
assertEquals("bean custom message", exception.getFaultInfo().getMessage());
}