julia_v_iluhina

Untitled

Oct 10th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.48 KB | None | 0 0
  1. public interface SmartElement extends SmartEntity<WebElement>, WebElement {
  2.  
  3.     void setValue(String text);
  4.     /*
  5.         а пусть метод возвращает SmartElement
  6.  
  7.         ну и вполне можно дореализовать doubleClick() & hover()
  8.     */
  9.     SmartElement shouldBe(Condition<WebElement>... conditions);
  10.     SmartElement shoudHave(Condition<WebElement> condition);
  11.     /*
  12.        не shoudHave
  13.        а  shouldHave
  14.  
  15.        ну и параметр методу подправь тоже
  16.        лучше
  17.         не Condition<WebElement> condition
  18.         а Condition<WebElement>... conditions
  19.  
  20.        тогда сможешь методы вызвать как для одного кондишена, так и для нескольких
  21.     */
  22. }
  23. ************************************************
  24. public interface SmartCollection extends SmartEntity<List<WebElement>>, Iterable<SmartElement> {
  25.  
  26.     SmartCollection shoudBe(Condition<List<WebElement>>... conditions);
  27.     SmartCollection shoudHave(Condition<List<WebElement>>... conditions);
  28.  
  29. }
  30. /*
  31.     shou___l___d
  32.     тут тоже это поправь
  33. */
  34. ******************************
  35.     @Override
  36.     public Rectangle getRect() {
  37.         return null;
  38.     }
  39. /*
  40.     пропустил
  41. */
  42. *****************************
  43.     @Override
  44.     public WebElement getWrappedEntity() {
  45.         return getDriver().findElement(this.locator);
  46.     }
  47. /*
  48.     this.locator - тут можно и короче - locator
  49.  
  50.     нам тут можно не уточняться до this
  51.     т к нету тут параметра метода locator
  52.     и единственная переменная locator, которая доступна - это и есть this.locator
  53. */
  54. *************************************
  55. public abstract class AbstractCondition<V> extends Condition<V> {
  56.  
  57.     ...
  58.  
  59.     public abstract String expected();
  60.     public abstract String actual();
  61. /*
  62.     строки 350-376 прошлого ревью
  63. */
  64.  
  65. *****************************************
  66.  
  67. public interface SmartEntity<V> {
  68.  
  69.     V getWrappedEntity();
  70.     String identity();
  71.  
  72. }
  73. /*
  74.     и тут можно  - String identity();
  75.     вынести в отдельный интерфейс DescribesEntity
  76.  
  77.     и уже SmartEntity<V>  отнаследовать от DescribesEntity
  78.  
  79.     цель - разделить ответственности )
  80.     Single Responsibility Principle
  81.  
  82. */
Advertisement
Add Comment
Please, Sign In to add comment