Skip to content

Instantly share code, notes, and snippets.

@defunkt
Created July 23, 2008 18:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save defunkt/1837 to your computer and use it in GitHub Desktop.
Save defunkt/1837 to your computer and use it in GitHub Desktop.
# watch me turn java into ruby
def try; end
def catch(*args) end
def RuntimeException(*args) end
def re; end
class Anything; def method_missing(*args) Anything.new end end
def getDialog; Anything.new end
def WebResponse(*args) end
def atUrl; '' end
def assertEquals(*args) end
# now for the fun part
try {
beginAt(atUrl);
}
catch (RuntimeException re) {
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());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment