ScreenAreaResult implements Serializable { public boolean areaEquals(ScreenAreaResult other) { if (selector != null) { return selector.equals(other.selector); } return screenArea.getRectangle().equals(other.getScreenArea().getRectangle()); } ScreenAreaResult();  ScreenAreaResult(IndexDomSelector selector, RectangleArea rectangle, ScreenArea screenArea); IndexDomSelector getSelector(); RectangleArea getRectangle(); ScreenArea getScreenArea(); boolean areaEquals(ScreenAreaResult other); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void testAreaEquals_selector_equals() throws Exception { ScreenAreaResult result1 = new ScreenAreaResult(new IndexDomSelector(SelectorType.TAG_NAME, "body", 0), null, null); ScreenAreaResult result2 = new ScreenAreaResult(new IndexDomSelector(SelectorType.TAG_NAME, "body", 0), null, null); assertThat(result1.areaEquals(result2), is(true)); }
@Test public void testAreaEquals_selector_not_equals() throws Exception { ScreenAreaResult result1 = new ScreenAreaResult(new IndexDomSelector(SelectorType.TAG_NAME, "body", 0), null, null); ScreenAreaResult result2 = new ScreenAreaResult(new IndexDomSelector(SelectorType.TAG_NAME, "body", 1), null, null); assertThat(result1.areaEquals(result2), is(false)); }
@Test public void testAreaEquals_rectangle_equals() throws Exception { ScreenAreaResult result1 = new ScreenAreaResult(null, null, ScreenArea.of(1d, 1d, 1d, 1d)); ScreenAreaResult result2 = new ScreenAreaResult(null, null, ScreenArea.of(1d, 1d, 1d, 1d)); assertThat(result1.areaEquals(result2), is(true)); }
@Test public void testAreaEquals_rectangle_not_equals() throws Exception { ScreenAreaResult result1 = new ScreenAreaResult(null, null, ScreenArea.of(1d, 1d, 1d, 1d)); ScreenAreaResult result2 = new ScreenAreaResult(null, null, ScreenArea.of(2d, 1d, 1d, 1d)); assertThat(result1.areaEquals(result2), is(false)); }