Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try
- {
- beginAt(atUrl);
- }
- catch (RuntimeException re)
- {
- // If we get here, it's possible that we are running on java 1.5 +
- // and the server is websphere. in this combination (and only this
- // one AFAIK) the HttpUnit client receives a null from
- // HttpUrlConnection.getErrorStream() which, according to the JDK javadoc
- // is supposed to indicate that there is no error. It certainly means
- // nothing can be read from it!
- // Unfortunately, when HttpUnit then follows the getInputStream() call
- // tree it ends up with an IOException it didn't expect.
- // To add insult to injury, this IOException is not set as the cause
- // of the RuntimeException jwebunit wraps it in so we just make some small
- // efforts to ensure the basis of the
- // exception is the 503 we were hoping for.
- log.warn("Can't assert 503 response, using crude websphere workaround");
- assertTrue(re.getMessage().contains("IOException"));
- assertTrue(re.getMessage().contains("503"));
- return;
- }
- WebResponse webResponse = getDialog().getResponse();
- assertEquals("expected service unavailable response for url: '" + atUrl + "'",
- 503, webResponse.getResponseCode());
- assertEquals("should be no content for this url: '" + atUrl + "'", 0,
- webResponse.getText().length());
Add Comment
Please, Sign In to add comment