We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Erich Eichinger opened SWS-714 and commented
imho there is no need to catch the exception in
public ResponseActions sendRequest(RequestCreator requestCreator) { Assert.notNull(requestCreator, "'requestCreator' must not be null"); try { WebServiceMessage request = requestCreator.createRequest(messageFactory); MessageContext messageContext = new DefaultMessageContext(request, messageFactory); messageReceiver.receive(messageContext); return new MockWebServiceClientResponseActions(messageContext); } catch (Exception ex) { fail(ex.getMessage()); return null; } }
as this swallows any stacktrace. Why not just let the exception propagate?
Referenced from: commits d9ed89f
The text was updated successfully, but these errors were encountered:
Arjen Poutsma commented
The Exception cannot propagate because that would force users to deal with it in their integration tests, which is typically not what you want.
That said, I did add some additional logging so that the stacktrace is now fully logged and not lost.
Sorry, something went wrong.
Closing old issues
Ruben Suarez Alvarez commented
If you catch the exception and don't rethrow it, how am I supposed to test with an expected exception?
Supose I wan't to test a no end point call, something like this:
@Test(expected = NoEndpointFoundException.class) public void whenWrongEndpointThenNoEndpointFoundExceptionIsThrown() { Source requestPayload = new StringSource( "<badGetCountryRequest xmlns='http://org/eu/rubensa/ws/country'>" + "</badGetCountryRequest>"); mockClient.sendRequest(withPayload(requestPayload)); }
As original exception (NoEndpointFoundException) is captured, the exception thrown is an AssertionError, not the expected one, and test fails.
poutsma
No branches or pull requests
Erich Eichinger opened SWS-714 and commented
imho there is no need to catch the exception in
as this swallows any stacktrace. Why not just let the exception propagate?
Referenced from: commits d9ed89f
The text was updated successfully, but these errors were encountered: