openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject [openjpa] branch trunk updated: move openjpa-kernel to junit4 style
Date Sat, 13 Oct 2018 21:12:46 GMT
This is an automated email from the ASF dual-hosted git repository.

struberg pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openjpa.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 12ec80c  move openjpa-kernel to junit4 style
12ec80c is described below

commit 12ec80cd8cc034fa00fa3509a2d75959ef4b582b
Author: Mark Struberg <struberg@apache.org>
AuthorDate: Sat Oct 13 23:11:45 2018 +0200

    move openjpa-kernel to junit4 style
---
 .../org/apache/openjpa/conf/TestSpecification.java | 11 +++-
 .../apache/openjpa/ee/TestOSGiManagedRuntime.java  | 10 +++-
 .../apache/openjpa/ee/TestWASManagedRuntime.java   |  7 ++-
 .../openjpa/enhance/TestGetDeclaredMethod.java     |  9 +++-
 .../enhance/TestPCSubclassNameConversion.java      |  8 +--
 .../org/apache/openjpa/meta/TestAccessCode.java    | 13 ++++-
 .../org/apache/openjpa/meta/TestJavaTypes.java     |  8 ++-
 .../apache/openjpa/meta/TestMemberProvider.java    | 10 ++--
 .../org/apache/openjpa/util/TestProxyManager.java  | 58 +++++++++++++++++++---
 .../org/apache/openjpa/util/TestResultShape.java   | 21 ++++++--
 10 files changed, 125 insertions(+), 30 deletions(-)

diff --git a/openjpa-kernel/src/test/java/org/apache/openjpa/conf/TestSpecification.java b/openjpa-kernel/src/test/java/org/apache/openjpa/conf/TestSpecification.java
index ad36c41..72fc84c 100644
--- a/openjpa-kernel/src/test/java/org/apache/openjpa/conf/TestSpecification.java
+++ b/openjpa-kernel/src/test/java/org/apache/openjpa/conf/TestSpecification.java
@@ -19,14 +19,19 @@
 package org.apache.openjpa.conf;
 
 
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
 /**
  * Test basics of Specification object.
  *
  * @author Pinaki Poddar
  *
  */
-public class TestSpecification extends TestCase {
+public class TestSpecification {
+
+    @Test
     public void testStaticConstruction() {
         Specification spec1 = new Specification("JPA 2.3");
         assertEquals("JPA", spec1.getName());
@@ -49,6 +54,7 @@ public class TestSpecification extends TestCase {
         assertEquals("5", spec4.getMinorVersion());
     }
 
+    @Test
     public void testEqualityByName() {
         Specification spec1 = new Specification("JPA 2.3");
         Specification spec2 = new Specification("JPA 1.0");
@@ -62,6 +68,7 @@ public class TestSpecification extends TestCase {
         assertFalse(spec1.isSame(spec3));
     }
 
+    @Test
     public void testVersionCompare() {
         Specification spec1 = new Specification("JPA 1.1");
         Specification spec2 = new Specification("JPA 2.2");
diff --git a/openjpa-kernel/src/test/java/org/apache/openjpa/ee/TestOSGiManagedRuntime.java
b/openjpa-kernel/src/test/java/org/apache/openjpa/ee/TestOSGiManagedRuntime.java
index 584b5be..16b97ea 100644
--- a/openjpa-kernel/src/test/java/org/apache/openjpa/ee/TestOSGiManagedRuntime.java
+++ b/openjpa-kernel/src/test/java/org/apache/openjpa/ee/TestOSGiManagedRuntime.java
@@ -34,6 +34,7 @@ import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
 
 import org.apache.openjpa.util.InternalException;
+import org.junit.Test;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleException;
@@ -47,12 +48,13 @@ import org.osgi.framework.ServiceReference;
 import org.osgi.framework.ServiceRegistration;
 
 import junit.framework.AssertionFailedError;
-import junit.framework.TestCase;
+
+import static org.junit.Assert.*;
 
 /**
  * Test javax.transaction.TransactionManager OSGi service discovery.
  */
-public class TestOSGiManagedRuntime extends TestCase {
+public class TestOSGiManagedRuntime {
 
     private static final String TXN_MANAGER_CLASS_NAME = "javax.transaction.TransactionManager";
 
@@ -371,6 +373,7 @@ public class TestOSGiManagedRuntime extends TestCase {
      *
      * @throws Throwable
      */
+    @Test
     public void testTxnServiceDiscoveryPreStartPostStop() throws Throwable {
 
         TestBundleContext context = new TestBundleContext();
@@ -409,6 +412,7 @@ public class TestOSGiManagedRuntime extends TestCase {
      *
      * @throws Throwable
      */
+    @Test
     public void testTxnServiceDiscoveryPreStartPreStop() throws Throwable {
 
         TestBundleContext context = new TestBundleContext();
@@ -443,6 +447,7 @@ public class TestOSGiManagedRuntime extends TestCase {
      *
      * @throws Throwable
      */
+    @Test
     public void testTxnServiceDiscoveryPostStartPostStop() throws Throwable {
 
         TestBundleContext context = new TestBundleContext();
@@ -478,6 +483,7 @@ public class TestOSGiManagedRuntime extends TestCase {
      *
      * @throws Throwable
      */
+    @Test
     public void testTxnServiceDiscoveryPostStartPreStop() throws Throwable {
 
         TestBundleContext context = new TestBundleContext();
diff --git a/openjpa-kernel/src/test/java/org/apache/openjpa/ee/TestWASManagedRuntime.java
b/openjpa-kernel/src/test/java/org/apache/openjpa/ee/TestWASManagedRuntime.java
index 115a8fa..f1f37e3 100644
--- a/openjpa-kernel/src/test/java/org/apache/openjpa/ee/TestWASManagedRuntime.java
+++ b/openjpa-kernel/src/test/java/org/apache/openjpa/ee/TestWASManagedRuntime.java
@@ -19,14 +19,16 @@
 package org.apache.openjpa.ee;
 
 import org.apache.openjpa.lib.util.ClassUtil;
+import org.junit.Test;
 
-import junit.framework.TestCase;
+
+import static org.junit.Assert.*;
 
 /**
  * Test class for build transformation performed by WASManagedRuntime.
  *
  */
-public class TestWASManagedRuntime extends TestCase {
+public class TestWASManagedRuntime {
 
     /**
      * This test will verify that the WASManagedRuntime$WASSynchronization
@@ -37,6 +39,7 @@ public class TestWASManagedRuntime extends TestCase {
      *
      * @throws ClassNotFoundException
      */
+    @Test
     public void testInterfaceAdded() throws ClassNotFoundException {
 
         String msg = null;
diff --git a/openjpa-kernel/src/test/java/org/apache/openjpa/enhance/TestGetDeclaredMethod.java
b/openjpa-kernel/src/test/java/org/apache/openjpa/enhance/TestGetDeclaredMethod.java
index c68456a..0439957 100644
--- a/openjpa-kernel/src/test/java/org/apache/openjpa/enhance/TestGetDeclaredMethod.java
+++ b/openjpa-kernel/src/test/java/org/apache/openjpa/enhance/TestGetDeclaredMethod.java
@@ -18,19 +18,22 @@
  */
 package org.apache.openjpa.enhance;
 
+import org.junit.Test;
+
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.*;
 
 /**
  * Tests that {@link Reflection#getDeclaredMethod(Class, String, Class)}
  * returns the most-derived class's method when called from a type hierarchy.
  * See OPENJPA-251.
  */
-public class TestGetDeclaredMethod extends TestCase {
+public class TestGetDeclaredMethod {
 
+    @Test
     public void testGetDeclaredMethod() {
         Method meth =
             Reflection.getDeclaredMethod(Impl.class, "getObject", null);
@@ -38,6 +41,7 @@ public class TestGetDeclaredMethod extends TestCase {
         assertEquals(String.class, meth.getReturnType());
     }
 
+    @Test
     public void testMostDerived() throws NoSuchMethodException {
         Method impl = Impl.class.getDeclaredMethod("getObject", null);
         Method iface = Iface.class.getDeclaredMethod("getObject", null);
@@ -54,6 +58,7 @@ public class TestGetDeclaredMethod extends TestCase {
         }
     }
 
+    @Test
     public void testGenerics() throws NoSuchMethodException {
         List<Method> meths = new ArrayList<>();
         for (Method meth : GenericsImpl.class.getDeclaredMethods()) {
diff --git a/openjpa-kernel/src/test/java/org/apache/openjpa/enhance/TestPCSubclassNameConversion.java
b/openjpa-kernel/src/test/java/org/apache/openjpa/enhance/TestPCSubclassNameConversion.java
index da811b6..7e70f48 100644
--- a/openjpa-kernel/src/test/java/org/apache/openjpa/enhance/TestPCSubclassNameConversion.java
+++ b/openjpa-kernel/src/test/java/org/apache/openjpa/enhance/TestPCSubclassNameConversion.java
@@ -18,11 +18,13 @@
  */
 package org.apache.openjpa.enhance;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
-public class TestPCSubclassNameConversion
-    extends TestCase {
+import static org.junit.Assert.*;
 
+public class TestPCSubclassNameConversion {
+
+    @Test
     public void testPCSubclassNameConversion() {
         String name = PCEnhancer.toPCSubclassName(Object.class);
         assertTrue(PCEnhancer.isPCSubclassName(name));
diff --git a/openjpa-kernel/src/test/java/org/apache/openjpa/meta/TestAccessCode.java b/openjpa-kernel/src/test/java/org/apache/openjpa/meta/TestAccessCode.java
index 3b16eca..1cb699c 100644
--- a/openjpa-kernel/src/test/java/org/apache/openjpa/meta/TestAccessCode.java
+++ b/openjpa-kernel/src/test/java/org/apache/openjpa/meta/TestAccessCode.java
@@ -19,6 +19,9 @@
 package org.apache.openjpa.meta;
 
 import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
 
 /**
  * Access code is a 5-bit integer.
@@ -26,7 +29,7 @@ import junit.framework.TestCase;
  * @author Pinaki Poddar
  *
  */
-public class TestAccessCode extends TestCase {
+public class TestAccessCode {
     public static final int UNKNOWN = AccessCode.UNKNOWN;
     public static final int FIELD = AccessCode.FIELD;
     public static final int PROPERTY = AccessCode.PROPERTY;
@@ -34,6 +37,7 @@ public class TestAccessCode extends TestCase {
     public static final int MIXED = AccessCode.MIXED;
 
     // Valid class codes are 0 2 4 10 12 26 28
+    @Test
     public void testValidClassCodes() {
         isValidClassCode(true,   0, UNKNOWN);
 
@@ -63,6 +67,7 @@ public class TestAccessCode extends TestCase {
     }
 
     // Valid field codes are 0 2 4 10 12
+    @Test
     public void testValidFieldCodes() {
         isValidClassCode(true,   0, UNKNOWN);
 
@@ -83,6 +88,7 @@ public class TestAccessCode extends TestCase {
         }
     }
 
+    @Test
     public void testProperty() {
         isProperty(false,  0, UNKNOWN);
         isProperty(false,  2, FIELD);
@@ -93,6 +99,7 @@ public class TestAccessCode extends TestCase {
         isProperty(true,  28, MIXED | EXPLICIT | PROPERTY);
     }
 
+    @Test
     public void testField() {
         isField(false,  0, UNKNOWN);
         isField(true,   2, FIELD);
@@ -104,6 +111,7 @@ public class TestAccessCode extends TestCase {
         isField(false,  28, MIXED | EXPLICIT | PROPERTY);
     }
 
+    @Test
     public void testExplicit() {
         isExplicit(false,  0, UNKNOWN);
         isExplicit(false,  2, FIELD);
@@ -115,6 +123,7 @@ public class TestAccessCode extends TestCase {
         isExplicit(true,  28, MIXED | EXPLICIT | PROPERTY);
     }
 
+    @Test
     public void testMixed() {
         isMixed(false,  0, UNKNOWN);
         isMixed(false,  2, FIELD);
@@ -126,6 +135,7 @@ public class TestAccessCode extends TestCase {
         isMixed(true,  28, MIXED | EXPLICIT | PROPERTY);
     }
 
+    @Test
     public void testCompatibleField() {
         assertCompatible(EXPLICIT|FIELD, PROPERTY, MIXED|EXPLICIT|FIELD);
         assertCompatible(EXPLICIT|FIELD, FIELD, EXPLICIT|FIELD);
@@ -163,6 +173,7 @@ public class TestAccessCode extends TestCase {
         }
     }
 
+    @Test
     public void testToString() {
         assertEquals("explicit property access", AccessCode.toClassString(12));
     }
diff --git a/openjpa-kernel/src/test/java/org/apache/openjpa/meta/TestJavaTypes.java b/openjpa-kernel/src/test/java/org/apache/openjpa/meta/TestJavaTypes.java
index b1e9dc8..7d12c27 100644
--- a/openjpa-kernel/src/test/java/org/apache/openjpa/meta/TestJavaTypes.java
+++ b/openjpa-kernel/src/test/java/org/apache/openjpa/meta/TestJavaTypes.java
@@ -18,11 +18,15 @@
  */
 package org.apache.openjpa.meta;
 
-import junit.framework.TestCase;
 
-public class TestJavaTypes extends TestCase {
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+
+public class TestJavaTypes {
     TypesHolder _types = new TypesHolder();
 
+    @Test
     public void testIsPrimitiveDefault() {
         assertTrue(JavaTypes.isPrimitiveDefault(_types.getBoolean(), JavaTypes.BOOLEAN));
         assertTrue(JavaTypes.isPrimitiveDefault(_types.getChar(), JavaTypes.CHAR));
diff --git a/openjpa-kernel/src/test/java/org/apache/openjpa/meta/TestMemberProvider.java
b/openjpa-kernel/src/test/java/org/apache/openjpa/meta/TestMemberProvider.java
index fe59edb..c1ea049 100644
--- a/openjpa-kernel/src/test/java/org/apache/openjpa/meta/TestMemberProvider.java
+++ b/openjpa-kernel/src/test/java/org/apache/openjpa/meta/TestMemberProvider.java
@@ -26,13 +26,16 @@ import java.io.ObjectOutputStream;
 
 import org.apache.openjpa.meta.FieldMetaData.MemberProvider;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
-public class TestMemberProvider
-    extends TestCase {
+import static org.junit.Assert.assertEquals;
 
+public class TestMemberProvider {
+    // field gets accessed via reflection.
+    @SuppressWarnings("unused")
     private String field;
 
+    @Test
     public void testField()
         throws NoSuchFieldException, IOException, ClassNotFoundException {
         MemberProvider b = new MemberProvider(
@@ -41,6 +44,7 @@ public class TestMemberProvider
         assertEquals(b.getMember(), b2.getMember());
     }
 
+    @Test
     public void testMethod()
         throws NoSuchMethodException, IOException, ClassNotFoundException {
         MemberProvider b = new MemberProvider(
diff --git a/openjpa-kernel/src/test/java/org/apache/openjpa/util/TestProxyManager.java b/openjpa-kernel/src/test/java/org/apache/openjpa/util/TestProxyManager.java
index 96bc794..ef3f082 100644
--- a/openjpa-kernel/src/test/java/org/apache/openjpa/util/TestProxyManager.java
+++ b/openjpa-kernel/src/test/java/org/apache/openjpa/util/TestProxyManager.java
@@ -47,23 +47,26 @@ import java.util.TreeMap;
 import java.util.TreeSet;
 import java.util.Vector;
 
-import junit.framework.TestCase;
-import junit.textui.TestRunner;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
 
 /**
  * Test proxies generated by the proxy manager.
  *
  * @author Abe White
  */
-public class TestProxyManager extends TestCase {
+public class TestProxyManager {
 
     private ProxyManagerImpl _mgr;
 
-    @Override
+    @Before
     public void setUp() {
         _mgr = new ProxyManagerImpl();
     }
 
+    @Test
     public void testCopyLists() {
         List orig = new ArrayList();
         populate(orig);
@@ -99,6 +102,7 @@ public class TestProxyManager extends TestCase {
             assertTrue(l1.get(i) + " != " + l2.get(i), l1.get(i) == l2.get(i));
     }
 
+    @Test
     public void testCopySets() {
         Set orig = new HashSet();
         populate(orig);
@@ -118,6 +122,7 @@ public class TestProxyManager extends TestCase {
         assertEquals(s1, s2);
     }
 
+    @Test
     public void testCopySortedSets() {
         SortedSet orig = new TreeSet();
         populate(orig);
@@ -168,10 +173,12 @@ public class TestProxyManager extends TestCase {
         assertTrue(s1.equals(s2));
     }
 
+    @Test
     public void testCopyNullCollection() {
         assertNull(_mgr.copyCollection(null));
     }
 
+    @Test
     public void testCopyProxyCollection() {
         List orig = (List) _mgr.newCollectionProxy(ArrayList.class, null, null, true);
         populate(orig);
@@ -183,6 +190,7 @@ public class TestProxyManager extends TestCase {
         assertSortedSetsEqual(new TreeSet(torig), (SortedSet) _mgr.copyCollection(torig));
     }
 
+    @Test
     public void testCloneProxyCollection() {
         // List doesn't support clone()
 
@@ -192,6 +200,7 @@ public class TestProxyManager extends TestCase {
         assertSortedSetsEquals(new TreeSet(torig), (SortedSet) torig.clone());
     }
 
+    @Test
     public void testListMethodsProxied() throws Exception {
         Class proxy = _mgr.newCollectionProxy(ArrayList.class, null, null, true).getClass();
         assertListMethodsProxied(proxy);
@@ -235,6 +244,7 @@ public class TestProxyManager extends TestCase {
         assertNotNull(cls.getDeclaredMethod("set", new Class[] { int.class, Object.class
}));
     }
 
+    @Test
     public void testSetMethodsProxied() throws Exception {
         Class proxy = _mgr.newCollectionProxy(HashSet.class, null, null, true).getClass();
         assertCollectionMethodsProxied(proxy);
@@ -249,6 +259,7 @@ public class TestProxyManager extends TestCase {
         assertCollectionMethodsProxied(proxy);
     }
 
+    @Test
     public void testQueueMethodsProxied() throws Exception {
         Class queue = getQueueClass();
         if (queue == null)
@@ -268,6 +279,7 @@ public class TestProxyManager extends TestCase {
         }
     }
 
+    @Test
     public void testLinkedListMethodsProxied() throws Exception {
         Class proxy = _mgr.newCollectionProxy(LinkedList.class, null, null, true).getClass();
         assertListMethodsProxied(proxy);
@@ -277,6 +289,7 @@ public class TestProxyManager extends TestCase {
         assertNotNull(proxy.getDeclaredMethod("removeLast", (Class[]) null));
     }
 
+    @Test
     public void testVectorMethodsProxied() throws Exception {
         Class proxy = _mgr.newCollectionProxy(Vector.class, null, null, true).getClass();
         assertListMethodsProxied(proxy);
@@ -288,6 +301,7 @@ public class TestProxyManager extends TestCase {
         assertNotNull(proxy.getDeclaredMethod("setElementAt", new Class[] { Object.class,
int.class }));
     }
 
+    @Test
     public void testListChangeTracker() {
         Proxy coll = _mgr.newCollectionProxy(ArrayList.class, null, null, true);
         assertNotNull(coll);
@@ -298,6 +312,7 @@ public class TestProxyManager extends TestCase {
         assertTrue(ct.isOrdered());
     }
 
+    @Test
     public void testSetChangeTracker() {
         Proxy coll = _mgr.newCollectionProxy(HashSet.class, null, null, true);
         assertNotNull(coll);
@@ -308,17 +323,20 @@ public class TestProxyManager extends TestCase {
         assertFalse(ct.isOrdered());
     }
 
+    @Test
     public void testCollectionInterfaceProxy() {
         Proxy coll = _mgr.newCollectionProxy(Collection.class, null, null, true);
         assertNotNull(coll);
     }
 
+    @Test
     public void testListInterfaceProxy() {
         Proxy coll = _mgr.newCollectionProxy(List.class, null, null, true);
         assertNotNull(coll);
         assertTrue(coll instanceof List);
     }
 
+    @Test
     public void testSetInterfaceProxy() {
         Proxy coll = _mgr.newCollectionProxy(Set.class, null, null, true);
         assertNotNull(coll);
@@ -326,12 +344,14 @@ public class TestProxyManager extends TestCase {
         assertFalse(coll instanceof SortedSet);
     }
 
+    @Test
     public void testSortedSetInterfaceProxy() {
         Proxy coll = _mgr.newCollectionProxy(SortedSet.class, null, null, true);
         assertNotNull(coll);
         assertTrue(coll instanceof SortedSet);
     }
 
+    @Test
     public void testQueueInterfaceProxy() {
         Class queue = getQueueClass();
         if (queue == null)
@@ -342,6 +362,7 @@ public class TestProxyManager extends TestCase {
         assertTrue(queue.isInstance(coll));
     }
 
+    @Test
     public void testProxyCustomDefaultScopedType() throws Exception {
         // Use reflection to instantiate a type that isn't in the current package.
         Class<?> cls = Class.forName("org.apache.openjpa.util.custom.CustomProxyDefaultScopeType");
@@ -355,6 +376,7 @@ public class TestProxyManager extends TestCase {
         assertNull(_mgr.newCustomProxy(obj, true));
     }
 
+    @Test
     public void testProxyCustomDefaultScopedList() throws Exception {
         // Use reflection to instantiate a type that isn't in the current package.
         Class<?> cls = Class.forName("org.apache.openjpa.util.custom.CustomProxyDefaultScopeList");
@@ -379,6 +401,7 @@ public class TestProxyManager extends TestCase {
         }
     }
 
+    @Test
     public void testCopyMaps() {
         Map orig = new HashMap();
         populate(orig);
@@ -414,6 +437,7 @@ public class TestProxyManager extends TestCase {
         assertEquals(m1, m2);
     }
 
+    @Test
     public void testCopySortedMaps() {
         SortedMap orig = new TreeMap();
         populate(orig);
@@ -459,10 +483,12 @@ public class TestProxyManager extends TestCase {
         assertTrue(m1.equals(m2));
     }
 
+    @Test
     public void testCopyNullMap() {
         assertNull(_mgr.copyMap(null));
     }
 
+    @Test
     public void testCopyProxyMap() {
         Map orig = (Map) _mgr.newMapProxy(HashMap.class, null, null, null, true);
         populate(orig);
@@ -474,6 +500,7 @@ public class TestProxyManager extends TestCase {
         assertSortedMapsEqual(new TreeMap(torig), (SortedMap) _mgr.copyMap(torig));
     }
 
+    @Test
     public void testCloneProxyMap() {
         // Map does not support clone()
 
@@ -483,6 +510,7 @@ public class TestProxyManager extends TestCase {
         assertSortedMapsEquals(new TreeMap(torig), (SortedMap) torig.clone());
     }
 
+    @Test
     public void testMapMethodsProxied() throws Exception {
         Class proxy = _mgr.newMapProxy(HashMap.class, null, null, null, true).getClass();
         assertMapMethodsProxied(proxy);
@@ -525,6 +553,7 @@ public class TestProxyManager extends TestCase {
         }
     }
 
+    @Test
     public void testPropertiesMethodsProxied() throws Exception {
         Class proxy = _mgr.newMapProxy(Properties.class, null, null, null, true).getClass();
         assertMapMethodsProxied(proxy);
@@ -533,6 +562,7 @@ public class TestProxyManager extends TestCase {
         assertNotNull(proxy.getDeclaredMethod("loadFromXML", new Class[] { InputStream.class
}));
     }
 
+    @Test
     public void testCopyDates() {
         Date orig = new Date(1999);
         assertDatesEqual(orig, (Date) _mgr.copyDate(orig));
@@ -567,22 +597,26 @@ public class TestProxyManager extends TestCase {
         assertTrue(d1.equals(d2));
     }
 
+    @Test
     public void testCopyNullDate() {
         assertNull(_mgr.copyDate(null));
     }
 
+    @Test
     public void testCopyProxyDate() {
         Date orig = (Date) _mgr.newDateProxy(Time.class);
         orig.setTime(1999);
         assertDatesEqual(new Time(orig.getTime()), (Date) _mgr.copyDate(orig));
     }
 
+    @Test
     public void testCloneProxyDate() {
         Date orig = (Date) _mgr.newDateProxy(Time.class);
         orig.setTime(1999);
         assertDatesEquals(new Time(orig.getTime()), (Date) orig.clone());
     }
 
+    @Test
     public void testDateMethodsProxied() throws Exception {
         Class proxy = _mgr.newDateProxy(Date.class).getClass();
         assertDateMethodsProxied(proxy);
@@ -630,6 +664,7 @@ public class TestProxyManager extends TestCase {
         assertNotNull(cls.getDeclaredMethod("setNanos", new Class[] { int.class }));
     }
 
+    @Test
     public void testCopyCalendars() {
         Calendar orig = new GregorianCalendar();
         populate(orig);
@@ -663,10 +698,12 @@ public class TestProxyManager extends TestCase {
         assertTrue(c1.equals(c2));
     }
 
+    @Test
     public void testCopyNullCalendar() {
         assertNull(_mgr.copyCalendar(null));
     }
 
+    @Test
     public void testCopyProxyCalendar() {
         Calendar orig = (Calendar) _mgr.newCalendarProxy(GregorianCalendar.class, TimeZone.getTimeZone("CST"));
         populate(orig);
@@ -675,6 +712,7 @@ public class TestProxyManager extends TestCase {
         assertCalendarsEqual(cal, _mgr.copyCalendar(orig));
     }
 
+    @Test
     public void testCloneProxyCalendar() {
         Calendar orig = (Calendar) _mgr.newCalendarProxy(GregorianCalendar.class, TimeZone.getTimeZone("CST"));
         populate(orig);
@@ -683,11 +721,13 @@ public class TestProxyManager extends TestCase {
         assertCalendarsEquals(cal, (Calendar) orig.clone());
     }
 
+    @Test
     public void testCalendarAbstractClassProxy() {
         Proxy cal = _mgr.newCalendarProxy(Calendar.class, null);
         assertNotNull(cal);
     }
 
+    @Test
     public void testCalendarMethodsProxied() throws Exception {
         Class proxy = _mgr.newCalendarProxy(GregorianCalendar.class, TimeZone.getDefault()).getClass();
         assertCalendarMethodsProxied(proxy);
@@ -719,6 +759,7 @@ public class TestProxyManager extends TestCase {
         }
     }
 
+    @Test
     public void testCopyBeans() {
         CustomBean orig = new CustomBean();
         populate(orig);
@@ -736,6 +777,7 @@ public class TestProxyManager extends TestCase {
         bean.setNumber(99);
     }
 
+    @Test
     public void testNonproxyableBean() {
         NonproxyableBean orig = new NonproxyableBean(1);
         populate(orig);
@@ -744,6 +786,7 @@ public class TestProxyManager extends TestCase {
         assertNull(_mgr.newCustomProxy(orig, true));
     }
 
+    @Test
     public void testIsUnproxyable() {
         CustomBean validBean = new CustomBean();
         populate(validBean);
@@ -779,10 +822,12 @@ public class TestProxyManager extends TestCase {
         assertTrue(b1.getNumber() == b2.getNumber());
     }
 
+    @Test
     public void testCopyNullBean() {
         assertNull(_mgr.copyCustom(null));
     }
 
+    @Test
     public void testCopyProxyBean() {
         CustomBean orig = (CustomBean) _mgr.newCustomProxy(new CustomBean(), true);
         populate(orig);
@@ -791,6 +836,7 @@ public class TestProxyManager extends TestCase {
         assertBeansEqual(comp, (CustomBean) _mgr.copyCustom(orig));
     }
 
+    @Test
     public void testBeanMethodsProxied() throws Exception {
         Class proxy = _mgr.newCustomProxy(new CustomBean(), true).getClass();
         assertBeanMethodsProxied(proxy);
@@ -816,10 +862,6 @@ public class TestProxyManager extends TestCase {
         }
     }
 
-    public static void main(String[] args) {
-        TestRunner.run(TestProxyManager.class);
-    }
-
     /**
      * Used to test custom list handling. Copy constructor intentionally ommitted.
      */
diff --git a/openjpa-kernel/src/test/java/org/apache/openjpa/util/TestResultShape.java b/openjpa-kernel/src/test/java/org/apache/openjpa/util/TestResultShape.java
index dc67c80..576fea7 100644
--- a/openjpa-kernel/src/test/java/org/apache/openjpa/util/TestResultShape.java
+++ b/openjpa-kernel/src/test/java/org/apache/openjpa/util/TestResultShape.java
@@ -27,11 +27,14 @@ import java.util.Map;
 
 import org.apache.openjpa.kernel.FillStrategy;
 import org.apache.openjpa.kernel.ResultShape;
+import org.junit.Test;
 
-import junit.framework.TestCase;
 
-public class TestResultShape extends TestCase {
+import static org.junit.Assert.*;
 
+public class TestResultShape {
+
+    @Test
     public void testPrimitiveShapeIsImmutable() {
         ResultShape<Object> shape = new ResultShape<>(Object.class, true);
         assertCategory(shape, true, false, false);
@@ -49,6 +52,7 @@ public class TestResultShape extends TestCase {
         }
     }
 
+    @Test
     public void testArrayIsMutable() {
         ResultShape<Object[]> shape = new ResultShape<>(Object[].class);
         assertCategory(shape, false, true, false);
@@ -68,6 +72,7 @@ public class TestResultShape extends TestCase {
         assertCategory(shape, false, true, true);
     }
 
+    @Test
     public void testMethodImpliesMapStrategy() {
         FillStrategy<Map> strategy = new FillStrategy.Map<>(method(Map.class,
"put", Object.class, Object.class));
         ResultShape<Map> mapShape = new ResultShape<>(Map.class, strategy, true);
@@ -75,6 +80,7 @@ public class TestResultShape extends TestCase {
         assertEquals(FillStrategy.Map.class, mapShape.getStrategy().getClass());
     }
 
+    @Test
     public void testShapeWithConstrcutorStrategy() {
         FillStrategy<List> strategy = new FillStrategy.NewInstance<>(constructor(ArrayList.class,
int.class));
         ResultShape<List> listShape = new ResultShape<>(List.class, strategy);
@@ -82,6 +88,7 @@ public class TestResultShape extends TestCase {
         assertEquals(FillStrategy.NewInstance.class, listShape.getStrategy().getClass());
     }
 
+    @Test
     public void testGetCompositeTypes() {
         ResultShape<Object[]> root  = new ResultShape<>(Object[].class);
         FillStrategy<Bar> strategy1 = new FillStrategy.NewInstance<>(Bar.class);
@@ -103,6 +110,7 @@ public class TestResultShape extends TestCase {
         assertEquals(4, root.length());
     }
 
+    @Test
     public void testRecursiveNestingIsNotAllowed() {
         ResultShape<Object[]> root = new ResultShape<>(Object[].class);
         ResultShape<Bar> bar1 = new ResultShape<Bar>(Bar.class, new FillStrategy.NewInstance(Bar.class),
false);
@@ -125,6 +133,7 @@ public class TestResultShape extends TestCase {
     }
 
 
+    @Test
     public void testFill() {
         //Fill this shape: Foo{short, Bar{String, Double}};
         ResultShape<Foo> foo = new ResultShape<Foo>(Foo.class, new FillStrategy.NewInstance(Foo.class),
false);
@@ -141,8 +150,10 @@ public class TestResultShape extends TestCase {
         Foo result = foo.pack(values, types, aliases);
         assertEquals(200, result.shrt);
         assertEquals("bar1", result.b.string);
-        assertEquals(12.3, result.b.Dbl);
+        assertEquals(12.3, (double) result.b.Dbl, 0.1d);
     }
+
+    @Test
     public void testFill2() {
         //Fill this shape: Object[]{Foo, Object, Foo{short, Bar{String, Double}}, Bar{double}};
         ResultShape<Object[]> root = new ResultShape<>(Object[].class);
@@ -171,8 +182,8 @@ public class TestResultShape extends TestCase {
         assertEquals(Bar.class, result[3].getClass());
         assertEquals(200, ((Foo)result[2]).shrt);
         assertEquals("bar1", ((Foo)result[2]).b.string);
-        assertEquals(12.3, ((Foo)result[2]).b.Dbl);
-        assertEquals(45.6, ((Bar)result[3]).dbl);
+        assertEquals(12.3, (double)((Foo)result[2]).b.Dbl, 0.1d);
+        assertEquals(45.6, ((Bar)result[3]).dbl, 0.1d);
     }
 
     void assertCategory(ResultShape<?> s, boolean primitive, boolean compound, boolean
nesting) {


Mime
View raw message