### Question:
PageBuilder { public void addSwitchItems(int i, Inventory page) { if (i > 0 && i <= pages.size() - 1) { this.addItem(page, PREVIOUS_PAGE); } if (i >= 0 && i < pages.size() - 1) { this.addItem(page, NEXT_PAGE); } }  void rebuildSwitchersAfterRemoval(int removedPageIndex); void rebuildPageSwitchers(int pageIndex); void addSwitchItems(int i, Inventory page); void rebuildPageByIndex(int index); String pageTitle(int index, int total);  }### Answer:
@Test public void addSwitchItems() { PagesList pagesList = mock(PagesList.class); PageBuilder pageBuilder = new PageBuilder( "Title", mock(Server.class), pagesList ); when(pagesList.size()).thenReturn(3); Inventory page = mock(Inventory.class); pageBuilder.addSwitchItems(0, page); assertItemsSet(page, true, false); pageBuilder.addSwitchItems(1, page); assertItemsSet(page, true, true); pageBuilder.addSwitchItems(2, page); assertItemsSet(page, false, true); }