@Test public void setAutoCommit_table_shouldSucceed() throws SQLException { container.setAutoCommit(true); assertTrue(container.isAutoCommit()); container.setAutoCommit(false); Assert.assertFalse(container.isAutoCommit()); }
@Test public void itemWithExistingVersionColumnIsRemoved() throws SQLException { container.setAutoCommit(true); query.setVersionColumn(ID); assertTrue(container.removeItem(container.lastItemId())); }
@Test public void addItem_tableAddOneNewItem_autoCommit_sizeIsIncreased() throws SQLException { container.setAutoCommit(true); int originalSize = container.size(); container.addItem(); assertEquals(originalSize + 1, container.size()); }
@Test public void addItem_tableAddOneNewItem_autoCommit_returnsFinalItemId() throws SQLException { container.setAutoCommit(true); Object itemId = container.addItem(); Assert.assertNotNull(itemId); assertTrue(itemId instanceof RowId); Assert.assertFalse(itemId instanceof TemporaryRowId); }
@Test public void allIdsFound_table5000RowsLastId_autoCommit_shouldSucceed() throws SQLException { DataGenerator.addFiveThousandPeople(connectionPool); container.setAutoCommit(true); for (int i = 0; i < 5000; i++) { assertTrue(container.containsId(container.getIdByIndex(i))); } }