@Test(expected = IllegalStateException.class) public void closeTablePutValueShouldFail() throws Exception { dataTable.close(); Storeable value = new StoreableDataValue(types); value.setColumnAt(0, 5); value.setColumnAt(1, "book"); dataTable.put("key", value); }
@Test public void removeValidKeyTest() { Assert.assertNull(dataTable.remove("chair")); Storeable firstValue = new StoreableDataValue(types); firstValue.setColumnAt(0, 2); firstValue.setColumnAt(1, "black"); dataTable.put("cats", firstValue); Assert.assertEquals(dataTable.remove("cats"), firstValue); }
@Test public void getValidKey() throws Exception { Assert.assertNull(dataTable.get("one")); Storeable value = new StoreableDataValue(types); value.setColumnAt(0, 5); value.setColumnAt(1, "book"); dataTable.put("favourite", value); Assert.assertEquals(dataTable.get("favourite"), value); }
@Test public void putValidValueTest() { Storeable firstValue = new StoreableDataValue(types); firstValue.setColumnAt(0, 56); firstValue.setColumnAt(1, "pages"); Storeable secondValue = new StoreableDataValue(types); secondValue.setColumnAt(0, 40); secondValue.setColumnAt(1, "pages"); dataTable.put("qwerty", secondValue); Assert.assertEquals(dataTable.put("qwerty", firstValue), secondValue); Assert.assertNull(dataTable.put("key", firstValue)); }