Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
1 Critical
-
Resolution: Fixed
-
Affects Version/s: 2.5.0
-
Fix Version/s: 2.5.1
-
Component/s: ehcache-core
-
Labels:None
-
Terracotta Target:Ehcache 2.5.1
-
Fixed In Revision:5009, 5008
Description
import net.sf.ehcache.CacheManager; import net.sf.ehcache.Element; import org.junit.Assert; import org.junit.Test; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; public class EhcacheReplacementRegressionTest { @Test public void testReplaceMethod2() throws Exception { net.sf.ehcache.CacheManager manager = new CacheManager(); net.sf.ehcache.config.CacheConfiguration cacheConfiguration = new net.sf.ehcache.config.CacheConfiguration(); cacheConfiguration.setName("testCache"); cacheConfiguration.setCopyOnRead(true); cacheConfiguration.setCopyOnWrite(true); net.sf.ehcache.Ehcache cache = new net.sf.ehcache.Cache(cacheConfiguration); manager.addCache(cache); Long key = System.currentTimeMillis(); String value = "value" + key; cache.put(new Element(new Long(key), new String(value))); String nextValue = "value" + key + 1; assertThat(cache.replace(new Element(new Long(key), new String(value)), new Element(new Long(key), new String(nextValue))), is(true)); Assert.assertEquals(nextValue, cache.get(key).getValue()); } }
The above test passes in 2.4.6 but fails in 2.5.0
(In 2.5.0 that replace method returns false)
Trunk and 2.5.x