Guest User

Untitled

a guest
Feb 19th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. # watch me turn java into ruby
  2.  
  3. def try; end
  4. def catch(*args) end
  5. def RuntimeException(*args) end
  6. def re; end
  7. class Anything; def method_missing(*args) Anything.new end end
  8. def getDialog; Anything.new end
  9. def WebResponse(*args) end
  10. def atUrl; '' end
  11. def assertEquals(*args) end
  12.  
  13. # now for the fun part
  14.  
  15. try {
  16. beginAt(atUrl);
  17. }
  18. catch (RuntimeException re) {
  19. log.warn("Can't assert 503 response, using crude websphere workaround");
  20. assertTrue(re.getMessage().contains("IOException"));
  21. assertTrue(re.getMessage().contains("503"));
  22.  
  23. return;
  24. }
  25. WebResponse webResponse = getDialog().getResponse();
  26. assertEquals("expected service unavailable response for url: '" + atUrl + "'", 503, webResponse.getResponseCode());
  27. assertEquals("should be no content for this url: '" + atUrl + "'", 0, webResponse.getText().length());
Add Comment
Please, Sign In to add comment