@Test public void prevItemId_tableCurrentItem1337_returns1336() throws SQLException { DataGenerator.addFiveThousandPeople(connectionPool); Object itemId = container.getIdByIndex(1337); if (SQLTestsConstants.db == DB.ORACLE) { assertEquals( new RowId(new Object[] {1336 + offset}).toString(), container.prevItemId(itemId).toString()); } else { assertEquals(new RowId(new Object[] {1336 + offset}), container.prevItemId(itemId)); } }
@Test public void prevItemId_tableTwoNewlyAddedItems_returnsFirstAddedItem() throws SQLException { Object id1 = container.addItem(); Object id2 = container.addItem(); assertEquals(id1, container.prevItemId(id2)); }
@Test public void prevItemId_tableAddedItemRemoved_skipsRemovedItem() throws SQLException { Object first = container.lastItemId(); Object second = container.addItem(); Object third = container.addItem(); assertTrue(container.removeItem(second)); assertEquals(first, container.prevItemId(third)); }
@Test public void prevItemId_tableItemRemoved_skipsRemovedItem() throws SQLException { Object first = container.getIdByIndex(0); Object second = container.getIdByIndex(1); Object third = container.getIdByIndex(2); assertTrue(container.removeItem(second)); assertEquals(first, container.prevItemId(third)); }