Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. protected void assertLoaded() {
  2. assertTrue(condition1,"condition 1 failed");
  3. assertTrue(condition2,"condition 2 failed");
  4. }
  5.  
  6. protected boolean isLoadedBoolean() {
  7. try {
  8. assertLoaded();
  9. return true;
  10. }
  11. catch (Error e) {
  12. return false;
  13. }
  14.  
  15. protected void assertLoaded() {
  16. assertTrue(condition1,"condition 1 failed");
  17. assertTrue(condition2,"condition 2 failed");
  18. }
  19.  
  20. protected boolean isLoadedBoolean() {
  21. return condition1 && condition2;
  22. }
  23.  
  24. public class PageLoadCheckFailure {
  25. public String reason;
  26. ... other interesting data ...
  27.  
  28. public PageLoadCheckFailure(reason, ... other interesting data ...) {
  29. this.reason = reason;
  30. etc.
  31. }
  32.  
  33. public String getReason() {
  34. return reason;
  35. }
  36.  
  37. ... getters for other interesting data ...
  38. }
  39.  
  40. protected PageLoadCheckFailure checkWhetherLoaded() {
  41. if (!condition1) {
  42. return new PageLoadCheckFailure("condition 1 failed", ... other interesting data...);
  43. }
  44. if (!condition2) {
  45. return new PageLoadCheckFailure("condition 1 failed", ... other interesting data...);
  46. }
  47. return nil;
  48. }
  49.  
  50. protected void assertLoaded() {
  51. PageLoadCheckFailure result = checkWhetherLoaded();
  52. if (result != nil) {
  53. Assert.fail(result.toString());
  54. }
  55. }
  56.  
  57. protected boolean isLoadedBoolean() {
  58. return checkWhetherLoaded() == nil;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement