DATACOUCH-53 - protection against NPE on CouchbaseCache when putting null as a value

This commit is contained in:
Andrzej Wislowski
2013-12-03 23:18:27 +01:00
committed by Michael Nitschinger
parent 7d79d79e28
commit b11fc6c53c
2 changed files with 23 additions and 2 deletions

View File

@@ -97,4 +97,21 @@ public class CouchbaseCacheTests {
assertNull(result);
}
/**
* Putting into cache on the same key not null value, and then null value,
* results in null object
*/
@Test
public void testSettingNullAndGetting() {
CouchbaseCache cache = new CouchbaseCache(cacheName, client);
String key = "couchbase-cache-test";
String value = "Hello World!";
cache.put(key, value);
cache.put(key, null);
assertNull(cache.get(key));
}
}