@Test public void rideNOTOnRightSide() throws Exception { Board board = mock(Board.class); StickyLaneLayout layout = new StickyLaneLayout(board); Lane lane1 = createLaneMock(10, 10, 100, 100); when(board.getLanes()).thenReturn(new Lane[] {lane1}); Lane lane = createLaneMock(111, 20, 50, 50); Rectangle actual = layout.rideOn(lane, createRectangle(lane)); assertNull(actual); }
@Test public void notRideOnIconSide() throws Exception { Board board = mock(Board.class); StickyLaneLayout layout = new StickyLaneLayout(board); Lane lane1 = createLaneMock(100, 210, 100, 100); when(lane1.isIconized()).thenReturn(true); when(board.getLanes()).thenReturn(new Lane[] {lane1}); Lane lane = createLaneMock(80, 280, 50, 50); Rectangle actual = layout.rideOn(lane, createRectangle(lane)); assertNull(actual); }
@Test public void rideOnDownLeftSide() throws Exception { Board board = mock(Board.class); StickyLaneLayout layout = new StickyLaneLayout(board); Lane lane1 = createLaneMock(100, 210, 100, 100); when(board.getLanes()).thenReturn(new Lane[] {lane1}); Lane lane = createLaneMock(80, 280, 50, 50); Rectangle actual = layout.rideOn(lane, createRectangle(lane)); assertNotNull(actual); assertThat(actual, is(new Rectangle(50, 210, 50, 50))); }