Index: ../core/src/test/java/org/infinispan/api/CacheAPITest.java =================================================================== --- ../core/src/test/java/org/infinispan/api/CacheAPITest.java (revision 1830) +++ ../core/src/test/java/org/infinispan/api/CacheAPITest.java (revision ) @@ -12,6 +12,8 @@ import org.infinispan.util.concurrent.IsolationLevel; import org.testng.annotations.Test; +import javax.transaction.NotSupportedException; +import javax.transaction.SystemException; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -453,4 +455,18 @@ assert cache.isEmpty(); } + + public void testPutIfAbsentAfterRemoveInTx() throws SystemException, NotSupportedException { + String key = "key_1", old_value = "old_value", new_value = "new_value"; + cache.put(key, old_value); + assert cache.get(key).equals(old_value); + + TestingUtil.getTransactionManager(cache).begin(); + assert cache.remove(key).equals(old_value); + assert cache.get(key) == null; + assert cache.putIfAbsent(key, new_value) == null; + TestingUtil.getTransactionManager(cache).rollback(); + + assert cache.get(key).equals(new_value); -} + } +}