Cache.get(key, type) should also work in case of null value found in cache

Issue: SPR-11567
This commit is contained in:
Juergen Hoeller
2014-03-18 00:50:59 +01:00
parent 57af56aeeb
commit 38e7c4776b
7 changed files with 36 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2013 the original author or authors.
* Copyright 2010-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,6 +28,7 @@ import static org.junit.Assert.*;
/**
* @author Costin Leau
* @author Juergen Hoeller
*/
public class ConcurrentCacheTests {
@@ -62,11 +63,20 @@ public class ConcurrentCacheTests {
Object value = "george";
assertNull(cache.get(key));
assertNull(cache.get(key, String.class));
assertNull(cache.get(key, Object.class));
cache.put(key, value);
assertEquals(value, cache.get(key).get());
assertEquals(value, cache.get(key, String.class));
assertEquals(value, cache.get(key, Object.class));
assertEquals(value, cache.get(key, null));
cache.put(key, null);
assertNotNull(cache.get(key));
assertNull(cache.get(key).get());
assertNull(cache.get(key, String.class));
assertNull(cache.get(key, Object.class));
}
@Test