@Mock
private WindowPanel window;
@Test
public void getVisiblePartsDoesNotReturnSameAreaTwice() {
Area underTest = new Area(new Rectangle(0, 0, 100, 100), window, null);
List<Area> windowAreas = new ArrayList<Area>();
windowAreas.add(new Area(new Rectangle(0, 0, 50, 100), otherWindow1,
null));
windowAreas.add(new Area(new Rectangle(0, 0, 50, 100), otherWindow2,
null));
when(window.getZIndex()).thenReturn(0);
when(otherWindow1.getZIndex()).thenReturn(1);
when(otherWindow2.getZIndex()).thenReturn(2);
List<Area> result = underTest.getVisibleParts(windowAreas);
assertEquals(1, result.size());
Rectangle rectangle = result.get(0).getRectangle();
assertEquals(50, rectangle.getX());
assertEquals(50, rectangle.getWidth());
assertEquals(0, rectangle.getY());
assertEquals(100, rectangle.getHeight());
}