@Test public void deleteFromNonExistingNamespace() { assertEquals(0, store.countNamespaces()); assertEquals(0, store.sizeOfNamespace(NAMESPACE1)); store.delete(NAMESPACE1, KEY1); assertEquals(0, store.countNamespaces()); assertEquals(0, store.sizeOfNamespace(NAMESPACE1)); }
@Test public void deleteExistingKey() { Serializable value = "value"; store.put(NAMESPACE1, KEY1, value); assertEquals(1, store.sizeOfNamespace(NAMESPACE1)); store.delete(NAMESPACE1, KEY1); assertEquals(0, store.sizeOfNamespace(NAMESPACE1)); }
@Test public void getFromNonExistingNameSpace() { assertEquals(0, store.sizeOfNamespace(NAMESPACE1)); Serializable retrievedValue = store.get(NAMESPACE1, KEY1); assertNull(retrievedValue); }
@Test public void putNull() { Serializable value = null; assertEquals(0, store.countNamespaces()); store.put(NAMESPACE1, KEY1, value); assertEquals(1, store.countNamespaces()); assertEquals(1, store.sizeOfNamespace(NAMESPACE1)); }
@Test public void putToEmptyStoreCreatesNamespace() { Serializable value = "value"; assertEquals(0, store.countNamespaces()); store.put(NAMESPACE1, KEY1, value); assertEquals(1, store.countNamespaces()); assertEquals(1, store.sizeOfNamespace(NAMESPACE1)); }
@Test public void getNonExistingKey() { Serializable value = "value"; store.put(NAMESPACE1, KEY1, value); assertEquals(1, store.sizeOfNamespace(NAMESPACE1)); Serializable retrievedValue = store.get(NAMESPACE1, KEY2); assertNull(retrievedValue); }
@Test public void putDifferentKeysToSameNamespace() { Serializable value = "value"; assertEquals(0, store.countNamespaces()); store.put(NAMESPACE1, KEY1, value); store.put(NAMESPACE1, KEY2, value); assertEquals(1, store.countNamespaces()); assertEquals(2, store.sizeOfNamespace(NAMESPACE1)); }