julia_v_iluhina

Untitled

Dec 27th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.58 KB | None | 0 0
  1.  public void open(WebDriver driver, String url)
  2.  /*
  3.     забыл убрать параметр WebDriver driver
  4.  */
  5.  *******************************
  6.  public static ExpectedCondition<List<WebElement>> listNthElementHasText(final By elementsLocator, final int index, final String text) {
  7.           if (text.equals(0) & index < 0) {
  8.              throw new IllegalArgumentException("Array of expected texts is empty.");
  9.          }
  10. /*
  11.     это с прошлого раза осталось
  12.  
  13.     см ревью к прошлой работе
  14.  
  15.     я бы если и стала реализовывать
  16.     то что-то вот такое
  17. */
  18.         if (text.isEmpty()) {
  19.              throw new IllegalArgumentException("Expected text is empty.");
  20.         }
  21.         if (index < 0)) {
  22.              throw new IllegalArgumentException("Index is negative.");
  23.         }
  24. /*
  25.     почему 2 if-a - т к нам нужно описать проблемы эти по-разному
  26.  
  27.     или один if (с условием (text.isEmpty() || (index < 0)))
  28.         но тогда описать нужно проблему по-другому
  29.  
  30.         что-то типа
  31.         Expected text shoul be not empty
  32.         Index should be >= 0
  33.  
  34.     http://stackoverflow.com/questions/3321526/should-i-use-string-isempty-or-equalsstring
  35.     https://docs.oracle.com/javase/tutorial/java/nutsandbolts/op2.html (раздел The Conditional Operators)
  36.     http://stackoverflow.com/questions/1795808/and-and-or-in-if-statements
  37. */
  38. **********************************************
Advertisement
Add Comment
Please, Sign In to add comment