gist: 1837 Download_button fork
public
Public Clone URL: git://gist.github.com/1837.git
java_or_ruby.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 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());

Owner

defunkt

Revisions