@Test public void testRemoveCalledForCorrectExistentKey() throws IOException, DatabaseCorruptedException { DataFile test = new DataFile(testDir, new Coordinates(folderIndex, fileIndex), table, provider); test.put(correctKey1, testStoreableValue); assertEquals(testStoreableValue, test.remove(correctKey1)); }
@Test public void testSizeMethod() throws IOException, DatabaseCorruptedException { DataFile test = new DataFile(testDir, new Coordinates(folderIndex, fileIndex), table, provider); test.put(correctKey1, testStoreableValue); assertEquals(test.size(), 1); test.remove(correctKey1); assertEquals(test.size(), 0); }
@Test public void testSavingEmptyDataFileToDisk() throws IOException, DatabaseCorruptedException { DataFile test = new DataFile(testDir, new Coordinates(folderIndex, fileIndex), table, provider); test.put(correctKey1, testStoreableValue); test.remove(correctKey1); test.commit(); test = new DataFile(testDir, new Coordinates(folderIndex, fileIndex), table, provider); assertTrue(test.list().isEmpty()); }
@Test(expected = IllegalArgumentException.class) public void testRemoveThrowsExceptionForKeyNotFromThisDataFile() throws IOException, DatabaseCorruptedException { DataFile test = new DataFile(testDir, new Coordinates(folderIndex, fileIndex), table, provider); test.remove(wrongKey); }