diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/java/com/amazon/carbonado/TestStorables.java | 23 | 
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/java/com/amazon/carbonado/TestStorables.java b/src/test/java/com/amazon/carbonado/TestStorables.java index 6301c30..3570e26 100644 --- a/src/test/java/com/amazon/carbonado/TestStorables.java +++ b/src/test/java/com/amazon/carbonado/TestStorables.java @@ -737,6 +737,29 @@ public class TestStorables extends TestCase {          assertTrue(s.tryUpdate());      } +    public void test_versioningSideEffect() throws Exception { +        Storage<StorableVersioned> storage = getRepository().storageFor(StorableVersioned.class); + +        StorableVersioned s = storage.prepare(); +        s.setID(500111); +        s.setValue("hello"); +        s.insert(); + +        s = storage.prepare(); +        s.setID(500111); +        s.setValue("world"); + +        assertEquals(false, s.tryInsert()); +        // Make sure that the failed insert removes the automatic initial +        // version number. +        try { +            s.update(); +            fail(); +        } catch (IllegalStateException e) { +            // Caused by not setting the version. +        } +    } +      public void test_versioningWithLong() throws Exception {          Storage<StorableVersionedWithLong> storage =              getRepository().storageFor(StorableVersionedWithLong.class);  | 
