commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r1094954 - in /commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime: TestArray.java TestDirectByteBuffer.java TestMain.java TestMemory.java TestReflect.java TestSemaphore.java TestString.java TestUnsafe.java TestUtils.java
Date Tue, 19 Apr 2011 09:10:04 GMT
Author: mturk
Date: Tue Apr 19 09:10:04 2011
New Revision: 1094954

URL: http://svn.apache.org/viewvc?rev=1094954&view=rev
Log:
Derive all test classes from tesng.Assert

Modified:
    commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestArray.java
    commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestDirectByteBuffer.java
    commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestMain.java
    commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestMemory.java
    commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestReflect.java
    commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestSemaphore.java
    commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestString.java
    commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestUnsafe.java
    commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestUtils.java

Modified: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestArray.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestArray.java?rev=1094954&r1=1094953&r2=1094954&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestArray.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestArray.java
Tue Apr 19 09:10:04 2011
@@ -22,7 +22,7 @@ import org.testng.annotations.*;
 import org.testng.Assert;
 import org.apache.commons.runtime.util.Array;
 
-public class TestArray
+public class TestArray extends Assert
 {
 
     @Test(groups = { "core" })
@@ -35,8 +35,8 @@ public class TestArray
         Array.copy(ia, 1, ba, 0, 3);
         // bytes 0 .. 3 contains integer[1] (2)
         // ### Assertion works on LSB machines only
-        Assert.assertEquals((int)ba[0] & 0xff, 2);
-        Assert.assertEquals((int)ba[4] & 0xff, 3);
-        Assert.assertEquals((int)ba[8] & 0xff, 4);
+        assertEquals((int)ba[0] & 0xff, 2);
+        assertEquals((int)ba[4] & 0xff, 3);
+        assertEquals((int)ba[8] & 0xff, 4);
     }
 }

Modified: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestDirectByteBuffer.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestDirectByteBuffer.java?rev=1094954&r1=1094953&r2=1094954&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestDirectByteBuffer.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestDirectByteBuffer.java
Tue Apr 19 09:10:04 2011
@@ -23,15 +23,15 @@ import org.testng.Assert;
 import java.nio.ByteBuffer;
 
 @Test(groups = { "core" })
-public class TestDirectByteBuffer
+public class TestDirectByteBuffer extends Assert
 {
 
     public void mallocDirectByteBuffer()
         throws Exception
     {
         ByteBuffer bb = DirectByteBuffer.allocate(1000);
-        Assert.assertTrue(bb.isDirect());
-        Assert.assertEquals(bb.capacity(), 1000);
+        assertTrue(bb.isDirect());
+        assertEquals(bb.capacity(), 1000);
         DirectByteBuffer.free(bb);
     }
 
@@ -39,8 +39,8 @@ public class TestDirectByteBuffer
         throws Exception
     {
         ByteBuffer bb = DirectByteBuffer.allocateAndClear(1000);
-        Assert.assertTrue(bb.isDirect());
-        Assert.assertEquals(bb.capacity(), 1000);
+        assertTrue(bb.isDirect());
+        assertEquals(bb.capacity(), 1000);
         DirectByteBuffer.free(bb);
     }
 
@@ -51,8 +51,8 @@ public class TestDirectByteBuffer
         // ptr, bb1 and bb2 share the same memory
         Pointer ptr = Memory.malloc(1000);
         ByteBuffer bb = DirectByteBuffer.allocate(ptr);
-        Assert.assertTrue(bb.isDirect());
-        Assert.assertEquals(bb.capacity(), 1000);
+        assertTrue(bb.isDirect());
+        assertEquals(bb.capacity(), 1000);
         /*
          * Call to the free crashes the JVM !
          * Also call to the any operation on any
@@ -70,8 +70,8 @@ public class TestDirectByteBuffer
         // ptr, bb1 and bb2 share the same memory
         Pointer ptr = Memory.malloc(1000);
         ByteBuffer bb = DirectByteBuffer.allocate(ptr);
-        Assert.assertTrue(bb.isDirect());
-        Assert.assertEquals(bb.capacity(), 1000);
+        assertTrue(bb.isDirect());
+        assertEquals(bb.capacity(), 1000);
         try {
             boolean test_me = Native.HAS_MAINTAINER_MODE;
             ptr.free();
@@ -90,12 +90,12 @@ public class TestDirectByteBuffer
         throws Exception
     {
         ByteBuffer bb = DirectByteBuffer.allocate(1000);
-        Assert.assertTrue(bb.isDirect());
+        assertTrue(bb.isDirect());
         bb.putInt(0xcafebabe);
         bb.rewind();
-        Assert.assertEquals(bb.getInt(), 0xcafebabe);
+        assertEquals(bb.getInt(), 0xcafebabe);
         DirectByteBuffer.set(bb, 0x55, 1000);
-        Assert.assertEquals(bb.getInt(), 0x55555555);
+        assertEquals(bb.getInt(), 0x55555555);
         DirectByteBuffer.free(bb);
     }
 
@@ -104,12 +104,12 @@ public class TestDirectByteBuffer
     {
         ByteBuffer sb = DirectByteBuffer.allocate(1000);
         ByteBuffer db = DirectByteBuffer.allocateAndClear(1000);
-//        Assert.assertTrue(sb.isDirect());
-//        Assert.assertTrue(db.isDirect());
+//        assertTrue(sb.isDirect());
+//        assertTrue(db.isDirect());
         sb.putInt(0xcafebabe);
         DirectByteBuffer.copy(sb, 0, db, 4, 996);
-        Assert.assertEquals(0, db.getInt());
-        Assert.assertEquals(db.getInt(), 0xcafebabe);
+        assertEquals(0, db.getInt());
+        assertEquals(db.getInt(), 0xcafebabe);
         DirectByteBuffer.free(sb);
         DirectByteBuffer.free(db);
     }

Modified: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestMain.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestMain.java?rev=1094954&r1=1094953&r2=1094954&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestMain.java (original)
+++ commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestMain.java Tue
Apr 19 09:10:04 2011
@@ -19,12 +19,12 @@ package org.apache.commons.runtime;
 import org.testng.annotations.*;
 import org.testng.Assert;
 
-public class TestMain
+public class TestMain extends Assert
 {
     @BeforeSuite(groups = { "init" })
     public void setUp()
     {
-        Assert.assertTrue(Loader.load());
+        assertTrue(Loader.load());
         System.out.println("Test initialized (pid=" + Vm.getPid() + ")");
         System.out.flush();
     }

Modified: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestMemory.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestMemory.java?rev=1094954&r1=1094953&r2=1094954&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestMemory.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestMemory.java
Tue Apr 19 09:10:04 2011
@@ -20,7 +20,7 @@ import org.testng.annotations.*;
 import org.testng.Assert;
 import java.io.IOException;
 
-public class TestMemory
+public class TestMemory extends Assert
 {
 
 
@@ -28,14 +28,14 @@ public class TestMemory
     public void zeroMalloc()
     {
         Pointer p = Memory.malloc();
-        Assert.assertNotNull(p);
+        assertNotNull(p);
     }
 
     @Test(groups = { "private" }, expectedExceptions={ NullPointerException.class })
     public void pokeToNullPointer()
     {
         Pointer p = Memory.malloc();
-        Assert.assertNotNull(p);
+        assertNotNull(p);
         Memory.poke(p, 0, 1);
     }
 
@@ -43,12 +43,12 @@ public class TestMemory
     public void align()
         throws Exception
     {
-        Assert.assertEquals(Memory.align(3, 4), 4);
-        Assert.assertEquals(Memory.align(3),    8);
-        Assert.assertEquals(Memory.align(0),    0);
-        Assert.assertEquals(Memory.align(-3),   0);
-        Assert.assertEquals(Memory.align(-8),  -8);
-        Assert.assertEquals(Memory.align(1L, 16), 16);
+        assertEquals(Memory.align(3, 4), 4);
+        assertEquals(Memory.align(3),    8);
+        assertEquals(Memory.align(0),    0);
+        assertEquals(Memory.align(-3),   0);
+        assertEquals(Memory.align(-8),  -8);
+        assertEquals(Memory.align(1L, 16), 16);
     }
 
     @Test(groups = { "private" }, expectedExceptions={ NullPointerException.class })
@@ -56,7 +56,7 @@ public class TestMemory
         throws Throwable
     {
         Pointer p = Memory.malloc();
-        Assert.assertNotNull(p);
+        assertNotNull(p);
         p.free();
     }
 
@@ -65,7 +65,7 @@ public class TestMemory
         throws Throwable
     {
         Pointer p = Pointer.NULL;
-        Assert.assertNotNull(p);
+        assertNotNull(p);
         p.free();
     }
 
@@ -74,7 +74,7 @@ public class TestMemory
         throws Throwable
     {
         Pointer p = Memory.malloc(1000);
-        Assert.assertNotNull(p);
+        assertNotNull(p);
         p.free();
     }
 
@@ -83,7 +83,7 @@ public class TestMemory
         throws Throwable
     {
         Pointer p = Memory.malloc(1000);
-        Assert.assertNotNull(p);
+        assertNotNull(p);
         Pointer s = Memory.slice(p, 0, 1000);
         p.free();
         s.free();
@@ -94,12 +94,12 @@ public class TestMemory
         throws Throwable
     {
         Pointer p = Memory.calloc(1000);
-        Assert.assertNotNull(p);
+        assertNotNull(p);
         Memory.set(p, 0, 1000, 0xFF);
         byte[] b = Memory.toByteArray(p, 0, 1000);
-        Assert.assertNotNull(b);
-        Assert.assertEquals(b.length, 1000);
-        Assert.assertEquals(b[0], (byte)0xFF);
+        assertNotNull(b);
+        assertEquals(b.length, 1000);
+        assertEquals(b[0], (byte)0xFF);
 
         p.free();
     }

Modified: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestReflect.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestReflect.java?rev=1094954&r1=1094953&r2=1094954&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestReflect.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestReflect.java
Tue Apr 19 09:10:04 2011
@@ -21,28 +21,28 @@ import org.testng.annotations.*;
 import org.testng.Assert;
 
 @Test(groups = { "core" })
-public class TestReflect
+public class TestReflect extends Assert
 {
 
     public void findClass()
     {
         // Uses JNI class naming.
         Class c1 = Reflect.findClass("Ljava/lang/System;");
-        Assert.assertEquals(c1.getCanonicalName(), "java.lang.System");
+        assertEquals(c1.getCanonicalName(), "java.lang.System");
         Class c2 = Reflect.findClass("java.lang.System");
-        Assert.assertEquals(c1.getCanonicalName(), "java.lang.System");
+        assertEquals(c1.getCanonicalName(), "java.lang.System");
     }
 
     public void allocObject()
         throws Exception
     {
         Class sc = Reflect.findClass("java/lang/String");
-        Assert.assertEquals(sc.getCanonicalName(), "java.lang.String");
+        assertEquals(sc.getCanonicalName(), "java.lang.String");
         Object o = Reflect.allocObject(sc);
-        Assert.assertNotNull(o);
+        assertNotNull(o);
         // Returns empty string since object was not initialized
         // only allocated.
-        Assert.assertEquals(o.toString(), "");
+        assertEquals(o.toString(), "");
     }
 
     public void reflectedClass()
@@ -50,9 +50,9 @@ public class TestReflect
     {
         // Uses JNI class naming.
         ReflectedClass cl = new ReflectedClass("java/lang/System");
-        Assert.assertEquals(cl.toString(), "java.lang.System");
+        assertEquals(cl.toString(), "java.lang.System");
         ReflectedMethod m = cl.getStaticMethod("load", "(Ljava/lang/String;)V");
-        Assert.assertNotNull(m);
+        assertNotNull(m);
     }
 
 }

Modified: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestSemaphore.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestSemaphore.java?rev=1094954&r1=1094953&r2=1094954&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestSemaphore.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestSemaphore.java
Tue Apr 19 09:10:04 2011
@@ -21,7 +21,7 @@ import java.io.File;
 import org.testng.annotations.*;
 import org.testng.Assert;
 
-public class TestSemaphore
+public class TestSemaphore extends Assert
 {
 
     private static final String semname = "acrSemop23";
@@ -36,7 +36,7 @@ public class TestSemaphore
             s.close();
         } catch (Exception ex) {
             System.out.println("Removing stalled semaphore " + semname);
-            Assert.assertTrue(Semaphore.remove(semname));
+            assertTrue(Semaphore.remove(semname));
         }
     }
 
@@ -45,7 +45,7 @@ public class TestSemaphore
         throws Exception
     {
         Semaphore s = Semaphore.create(semname, 0);
-        Assert.assertNotNull(s);
+        assertNotNull(s);
         System.out.println("Waiting for a child to attach");
         System.out.flush();
         s.acquire();
@@ -73,7 +73,7 @@ public class TestSemaphore
             Thread.sleep(step);
             step *= 2;
         }
-        Assert.assertNotNull(s);
+        assertNotNull(s);
         s.release();
         s.close();
         System.out.println("Child done.");

Modified: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestString.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestString.java?rev=1094954&r1=1094953&r2=1094954&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestString.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestString.java
Tue Apr 19 09:10:04 2011
@@ -20,7 +20,7 @@ import org.testng.annotations.*;
 import org.testng.Assert;
 import java.io.IOException;
 
-public class TestString
+public class TestString extends Assert
 {
 
     /* Zwölf in UTF-8 */
@@ -33,7 +33,7 @@ public class TestString
         throws Exception
     {
         String s = new String(gUIF, 0, gUIF.length, "utf-8");
-        Assert.assertEquals(test0(s), 6);
+        assertEquals(test0(s), 6);
     }
 
     @Test(groups = { "private" })
@@ -41,7 +41,7 @@ public class TestString
         throws Exception
     {
         String s = new String(gUIF, 0, gUIF.length, "UtF-8");
-        Assert.assertEquals(test1(s), 5);
+        assertEquals(test1(s), 5);
     }
 
 }

Modified: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestUnsafe.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestUnsafe.java?rev=1094954&r1=1094953&r2=1094954&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestUnsafe.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestUnsafe.java
Tue Apr 19 09:10:04 2011
@@ -22,7 +22,7 @@ import java.lang.reflect.*;
 import java.io.FileDescriptor;
 import org.apache.commons.runtime.io.Utils;
 
-public class TestUnsafe
+public class TestUnsafe extends Assert
 {
     private int i = 12345;
     private static native int test0(Object o, int off);
@@ -41,7 +41,7 @@ public class TestUnsafe
         throws Exception
     {
         int off = Unsafe.objectFieldOffset(TestUnsafe.class.getDeclaredField("i"));
-        Assert.assertEquals(test0(this, off), i);
+        assertEquals(test0(this, off), i);
     }
 
     @Test(groups = { "private" })
@@ -50,7 +50,7 @@ public class TestUnsafe
     {
         int fd = Utils.getFd(FileDescriptor.out);
         long fh = Utils.getHandle(FileDescriptor.out);
-        Assert.assertTrue(0 != (fd + fh));
+        assertTrue(0 != (fd + fh));
     }
 
 }

Modified: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestUtils.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestUtils.java?rev=1094954&r1=1094953&r2=1094954&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestUtils.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestUtils.java
Tue Apr 19 09:10:04 2011
@@ -22,13 +22,13 @@ import org.testng.annotations.*;
 import org.testng.Assert;
 import org.apache.commons.runtime.util.Utils;
 
-public class TestUtils
+public class TestUtils extends Assert
 {
 
     @Test(groups = { "core" })
     public void getTempPath()
     {
-        Assert.assertNotNull(Utils.getTempPath());
+        assertNotNull(Utils.getTempPath());
     }
 
     @Test(groups = { "core" })
@@ -36,9 +36,9 @@ public class TestUtils
         throws IOException
     {
         File tmp = Utils.createTempDirectory("acrTest");
-        Assert.assertNotNull(tmp);
+        assertNotNull(tmp);
         System.out.println("Utils.createTempDirectory: `" + tmp.getPath() + "'");
-        Assert.assertTrue(Utils.deleteDirectory(tmp));
+        assertTrue(Utils.deleteDirectory(tmp));
     }
 
     @Test(groups = { "core" })
@@ -46,9 +46,9 @@ public class TestUtils
         throws IOException
     {
         int i = -1;
-        Assert.assertEquals(Utils.hex(i), "ffffffff");
+        assertEquals(Utils.hex(i), "ffffffff");
         i = 0xcafebabe;
-        Assert.assertEquals(Utils.hex(i), "cafebabe");
+        assertEquals(Utils.hex(i), "cafebabe");
     }
 
     @Test(groups = { "core" })
@@ -56,9 +56,9 @@ public class TestUtils
         throws IOException
     {
         long l = -1;
-        Assert.assertEquals(Utils.hex(l), "ffffffffffffffff");
+        assertEquals(Utils.hex(l), "ffffffffffffffff");
         l = 0xcafebabedeadbeefL;
-        Assert.assertEquals(Utils.hex(l), "cafebabedeadbeef");
+        assertEquals(Utils.hex(l), "cafebabedeadbeef");
     }
 
     @Test(groups = { "core" })
@@ -74,7 +74,7 @@ public class TestUtils
         long asc = Memory.align(sec, 2);
         long acs = Memory.align(css, 2);
         
-        Assert.assertEquals(asc, acs);
+        assertEquals(asc, acs);
     }
 
 }



Mime
View raw message