diff options
Diffstat (limited to 'test/java/compat/src/com/sleepycat/persist/test/NegativeTest.java')
| -rw-r--r-- | test/java/compat/src/com/sleepycat/persist/test/NegativeTest.java | 57 |
1 files changed, 40 insertions, 17 deletions
diff --git a/test/java/compat/src/com/sleepycat/persist/test/NegativeTest.java b/test/java/compat/src/com/sleepycat/persist/test/NegativeTest.java index 8810eded..aba7e7c9 100644 --- a/test/java/compat/src/com/sleepycat/persist/test/NegativeTest.java +++ b/test/java/compat/src/com/sleepycat/persist/test/NegativeTest.java @@ -1,21 +1,30 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 2002, 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2015 Oracle and/or its affiliates. All rights reserved. * */ package com.sleepycat.persist.test; +import static com.sleepycat.persist.model.DeleteAction.NULLIFY; import static com.sleepycat.persist.model.Relationship.ONE_TO_MANY; import static com.sleepycat.persist.model.Relationship.ONE_TO_ONE; -import static com.sleepycat.persist.model.DeleteAction.NULLIFY; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.util.ArrayList; import java.util.Collection; +import java.util.List; import java.util.Locale; -import junit.framework.Test; +import org.junit.After; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; import com.sleepycat.db.DatabaseConfig; import com.sleepycat.db.DatabaseException; @@ -39,11 +48,19 @@ import com.sleepycat.util.test.TxnTestCase; * * @author Mark Hayes */ +@RunWith(Parameterized.class) public class NegativeTest extends TxnTestCase { - public static Test suite() { - testClass = NegativeTest.class; - return txnTestSuite(null, null); + @Parameters + public static List<Object[]> genParams() { + return getTxnParams(null, false); + } + + public NegativeTest(String type){ + initEnvConfig(); + txnType = type; + isTransactional = (txnType != TXN_NULL); + customName = txnType; } private EntityStore store; @@ -77,14 +94,7 @@ public class NegativeTest extends TxnTestCase { store = null; } - @Override - public void setUp() - throws Exception { - - super.setUp(); - } - - @Override + @After public void tearDown() throws Exception { @@ -99,6 +109,7 @@ public class NegativeTest extends TxnTestCase { super.tearDown(); } + @Test public void testBadKeyClass1() throws DatabaseException { @@ -123,12 +134,13 @@ public class NegativeTest extends TxnTestCase { static class UseBadKeyClass1 { @PrimaryKey - private BadKeyClass1 f1 = new BadKeyClass1(); + private final BadKeyClass1 f1 = new BadKeyClass1(); @SecondaryKey(relate=ONE_TO_ONE) - private BadKeyClass1 f2 = new BadKeyClass1(); + private final BadKeyClass1 f2 = new BadKeyClass1(); } + @Test public void testBadSequenceKeys() throws DatabaseException { @@ -202,6 +214,7 @@ public class NegativeTest extends TxnTestCase { * A proxied object may not current contain a field that references the * parent proxy. [#15815] */ + @Test public void testProxyNestedRef() throws DatabaseException { @@ -232,6 +245,7 @@ public class NegativeTest extends TxnTestCase { /** * Disallow primary keys on entity subclasses. [#15757] */ + @Test public void testEntitySubclassWithPrimaryKey() throws DatabaseException { @@ -321,6 +335,7 @@ public class NegativeTest extends TxnTestCase { /** * Disallow storing null entities. [#19085] */ + @Test public void testNullEntity() throws DatabaseException { @@ -343,6 +358,7 @@ public class NegativeTest extends TxnTestCase { /** * Disallow embedded entity classes and subclasses. [#16077] */ + @Test public void testEmbeddedEntity() throws DatabaseException { @@ -448,6 +464,7 @@ public class NegativeTest extends TxnTestCase { /** * Disallow SecondaryKey collection with no type parameter. [#15950] */ + @Test public void testTypelessKeyCollection() throws DatabaseException { @@ -472,7 +489,7 @@ public class NegativeTest extends TxnTestCase { private int x; @SecondaryKey(relate=ONE_TO_MANY) - private Collection keys = new ArrayList(); + private final Collection keys = new ArrayList(); TypelessKeyCollectionEntity(int x) { this.x = x; @@ -484,6 +501,7 @@ public class NegativeTest extends TxnTestCase { /** * Disallow a persistent proxy that extends an entity. [#15950] */ + @Test public void testProxyEntity() throws DatabaseException { @@ -519,6 +537,7 @@ public class NegativeTest extends TxnTestCase { /** * Wrapper type not allowed for nullified foreign key. */ + @Test public void testBadNullifyKey() throws DatabaseException { @@ -555,6 +574,7 @@ public class NegativeTest extends TxnTestCase { /** * @Persistent not allowed on an enum. */ + @Test public void testPersistentEnum() throws DatabaseException { @@ -584,6 +604,7 @@ public class NegativeTest extends TxnTestCase { /** * Disallow a reference to an interface marked @Persistent. */ + @Test public void testPersistentInterface() throws DatabaseException { @@ -617,6 +638,7 @@ public class NegativeTest extends TxnTestCase { /** * Disallow reference to @Persistent inner class. */ + @Test public void testPersistentInnerClass() throws DatabaseException { @@ -651,6 +673,7 @@ public class NegativeTest extends TxnTestCase { /** * Disallow @Entity inner class. */ + @Test public void testSetConfigAfterOpen() throws DatabaseException { |
