commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1301254 - in /commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile: ./ conversion/ morph/
Date Thu, 15 Mar 2012 22:46:51 GMT
Author: mbenson
Date: Thu Mar 15 22:46:50 2012
New Revision: 1301254

URL: http://svn.apache.org/viewvc?rev=1301254&view=rev
Log:
junit 4

Modified:
    commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/BasicFunctionalityTest.java
    commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/DefaultOptionsTest.java
    commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/DelimiterTest.java
    commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/DynamicFieldTest.java
    commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/EntityArrayLifecycleTest.java
    commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/EntityParserTestBase.java
    commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/FieldOptionsTest.java
    commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/FillerTest.java
    commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/ImmutableTest.java
    commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/LengthCheckTest.java
    commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/TypesTest.java
    commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/ValuesTest.java
    commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/conversion/BasicConversionTest.java
    commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/conversion/ConversionTestBase.java
    commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/morph/TextToByteConverterTest.java

Modified: commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/BasicFunctionalityTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/BasicFunctionalityTest.java?rev=1301254&r1=1301253&r2=1301254&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/BasicFunctionalityTest.java
(original)
+++ commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/BasicFunctionalityTest.java
Thu Mar 15 22:46:50 2012
@@ -16,14 +16,16 @@
  */
 package org.apache.commons.flatfile;
 
-import org.apache.commons.flatfile.EntityArray;
-import org.apache.commons.flatfile.EntityMap;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
 
 /**
  *
  */
 public class BasicFunctionalityTest extends EntityParserTestBase {
 
+    @Test
     public void testBasicFunctionality() throws Exception {
         EntityMap test1 = (EntityMap) entityFactory.getEntity("basic");
         assertEquals(1, test1.getChild("foo").length());
@@ -53,11 +55,6 @@ public class BasicFunctionalityTest exte
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.pgac.fixedlength.EntityParserTestBase#getSource()
-     */
     protected String getSource() {
         return "basic.test";
     }

Modified: commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/DefaultOptionsTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/DefaultOptionsTest.java?rev=1301254&r1=1301253&r2=1301254&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/DefaultOptionsTest.java
(original)
+++ commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/DefaultOptionsTest.java
Thu Mar 15 22:46:50 2012
@@ -16,11 +16,14 @@
  */
 package org.apache.commons.flatfile;
 
+import org.junit.Test;
+
 /**
  *
  */
 public class DefaultOptionsTest extends EntityParserTestBase {
 
+    @Test
     public void test1() {
         assertValue("@@@foo", entityFactory.getEntity("field1"));
         assertValue("foo@@@", entityFactory.getEntity("field2"));
@@ -30,11 +33,6 @@ public class DefaultOptionsTest extends 
         assertValue("&foo&&", entityFactory.getEntity("field6"));
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.pgac.fixedlength.EntityParserTestBase#getSource()
-     */
     protected String getSource() {
         return "defaultOptions.test";
     }

Modified: commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/DelimiterTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/DelimiterTest.java?rev=1301254&r1=1301253&r2=1301254&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/DelimiterTest.java
(original)
+++ commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/DelimiterTest.java
Thu Mar 15 22:46:50 2012
@@ -16,10 +16,13 @@
  */
 package org.apache.commons.flatfile;
 
+import org.junit.Test;
+
 /**
  *
  */
 public class DelimiterTest extends EntityParserTestBase {
+    @Test
     public void test1() throws Exception {
         StringBuffer buf = new StringBuffer("XX");
         for (int i = 0; i < 9; i++) {
@@ -37,11 +40,6 @@ public class DelimiterTest extends Entit
         assertValue("foo bar baz\r\nfoo bar baz\r\nfoo bar baz\r\n", entityFactory.getEntity("map39"));
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.pgac.fixedlength.EntityParserTestBase#getSource()
-     */
     protected String getSource() {
         return "delimiter.test";
     }

Modified: commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/DynamicFieldTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/DynamicFieldTest.java?rev=1301254&r1=1301253&r2=1301254&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/DynamicFieldTest.java
(original)
+++ commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/DynamicFieldTest.java
Thu Mar 15 22:46:50 2012
@@ -16,14 +16,17 @@
  */
 package org.apache.commons.flatfile;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.util.Arrays;
 
-import org.apache.commons.flatfile.DynamicField;
-import org.apache.commons.flatfile.EntityArray;
 import org.apache.commons.flatfile.FieldSupport.Overflow;
 import org.apache.commons.flatfile.FieldSupport.Underflow;
+import org.junit.Test;
 
 /**
  * Test dynamic fields.
@@ -38,6 +41,7 @@ public class DynamicFieldTest extends En
         Arrays.fill(LARGE_BYTES, (byte) 'a');
     }
 
+    @Test
     public void test1() throws Exception {
         DynamicField df = get("df1");
         assertEquals(0, df.length());
@@ -45,6 +49,7 @@ public class DynamicFieldTest extends En
         assertLoad(df);
     }
 
+    @Test
     public void test2() throws Exception {
         DynamicField df = get("df2");
         assertEquals(0, df.length());
@@ -52,6 +57,7 @@ public class DynamicFieldTest extends En
         assertLoad(df);
     }
 
+    @Test
     public void test3() throws Exception {
         DynamicField df = get("df3");
         assertEquals(0, df.length());
@@ -59,6 +65,7 @@ public class DynamicFieldTest extends En
         assertLoad(df);
     }
 
+    @Test
     public void test4() throws Exception {
         DynamicField df = get("df4");
         assertEquals(0, df.length());
@@ -66,15 +73,17 @@ public class DynamicFieldTest extends En
         assertLoad(df);
     }
 
+    @Test
     public void test5() throws Exception {
         DynamicField df = get("df5");
         assertEquals(3, df.length());
         byte[] foo = "foo".getBytes();
-        assertEquals(foo, df.getValue());
+        assertArrayEquals(foo, df.getValue());
         assertBounds(df, DynamicField.Bounds.DEFAULT);
         assertLoad(df);
     }
 
+    @Test
     public void test6() throws Exception {
         DynamicField df = get("df6");
         assertEquals(0, df.length());
@@ -82,6 +91,7 @@ public class DynamicFieldTest extends En
         assertLoad(df);
     }
 
+    @Test
     public void test7() throws Exception {
         DynamicField df = get("df7");
         assertEquals(0, df.length());
@@ -89,57 +99,64 @@ public class DynamicFieldTest extends En
         assertLoad(df);
     }
 
+    @Test
     public void test8() throws Exception {
         DynamicField df = get("df8");
         assertBounds(df, 1, 1);
-        assertEquals(new byte[] { ' ' }, df.getValue());
+        assertArrayEquals(new byte[] { ' ' }, df.getValue());
         assertLoad(df);
     }
 
+    @Test
     public void test9() throws Exception {
         DynamicField df = get("df9");
         assertBounds(df, 1, 3);
-        assertEquals(" ".getBytes(), df.getValue());
+        assertArrayEquals(" ".getBytes(), df.getValue());
         assertLoad(df);
     }
 
+    @Test
     public void testUnboundedArray() throws Exception {
         EntityArray a = (EntityArray) entityFactory.getEntity("unboundedArray");
         assertEquals(0, a.length());
         a.getChild(1).setValue("foo".getBytes());
-        assertEquals("foo".getBytes(), a.getValue());
+        assertArrayEquals("foo".getBytes(), a.getValue());
     }
 
+    @Test
     public void testUnboundedDelimitedArray() throws Exception {
         EntityArray a = (EntityArray) entityFactory
                 .getEntity("unboundedDelimitedArray");
-        assertEquals("---".getBytes(), a.getValue());
+        assertArrayEquals("---".getBytes(), a.getValue());
         a.getChild(1).setValue("foo".getBytes());
-        assertEquals("-foo--".getBytes(), a.getValue());
+        assertArrayEquals("-foo--".getBytes(), a.getValue());
     }
 
+    @Test
     public void testBoundedArray() throws Exception {
         EntityArray a = (EntityArray) entityFactory.getEntity("boundedArray");
-        assertEquals("   ".getBytes(), a.getValue());
+        assertArrayEquals("   ".getBytes(), a.getValue());
         a.getChild(1).setValue("foo".getBytes());
-        assertEquals(" foo ".getBytes(), a.getValue());
+        assertArrayEquals(" foo ".getBytes(), a.getValue());
     }
 
+    @Test
     public void testBoundedDelimitedArray() throws Exception {
         EntityArray a = (EntityArray) entityFactory
                 .getEntity("boundedDelimitedArray");
-        assertEquals(" \n \n \n".getBytes(), a.getValue());
+        assertArrayEquals(" \n \n \n".getBytes(), a.getValue());
         a.getChild(1).setValue("foo".getBytes());
-        assertEquals(" \nfoo\n \n".getBytes(), a.getValue());
+        assertArrayEquals(" \nfoo\n \n".getBytes(), a.getValue());
 
     }
 
+    @Test
     public void testNestedUncertainty() throws Exception {
         EntityArray a = (EntityArray) entityFactory
                 .getEntity("nestedUncertainty");
         assertTrue(a.isSizable());
         a.setSize(10);
-        assertEquals(SMALL_BYTES, a.getValue());
+        assertArrayEquals(SMALL_BYTES, a.getValue());
         StringBuffer buf = new StringBuffer();
         for (int i = 0; i < 10; i++) {
             byte[] b = new byte[i + 1];
@@ -147,7 +164,7 @@ public class DynamicFieldTest extends En
             buf.append(new String(b));
             a.getChild(i).setValue(b);
         }
-        assertEquals(buf.toString().getBytes(), a.getValue());
+        assertArrayEquals(buf.toString().getBytes(), a.getValue());
     }
 
     private void assertBounds(DynamicField df, int min, int max) {
@@ -172,7 +189,7 @@ public class DynamicFieldTest extends En
             expec = new byte[max];
             System.arraycopy(LARGE_BYTES, 0, expec, 0, expec.length);
         }
-        assertEquals(expec, df.getValue());
+        assertArrayEquals(expec, df.getValue());
     }
 
     private void testValue(DynamicField df, byte[] value) {
@@ -186,7 +203,7 @@ public class DynamicFieldTest extends En
                 df.setValue(value);
                 fail(new String(value));
             } catch (IllegalArgumentException e) {
-                assertEquals(old, df.getValue());
+                assertArrayEquals(old, df.getValue());
             }
         } else {
             df.setValue(value);
@@ -204,7 +221,7 @@ public class DynamicFieldTest extends En
      * @param a
      * @param b
      */
-    private void assertEquals(byte[] a, byte[] b) {
+    private void assertArrayEquals(byte[] a, byte[] b) {
         if (a != b) {
             if (a == null || b == null) {
                 fail();

Modified: commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/EntityArrayLifecycleTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/EntityArrayLifecycleTest.java?rev=1301254&r1=1301253&r2=1301254&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/EntityArrayLifecycleTest.java
(original)
+++ commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/EntityArrayLifecycleTest.java
Thu Mar 15 22:46:50 2012
@@ -16,10 +16,16 @@
  */
 package org.apache.commons.flatfile;
 
-import org.apache.commons.flatfile.EntityArray;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
 
 public class EntityArrayLifecycleTest extends EntityParserTestBase {
 
+    @Test
     public void testMe() throws Exception {
         EntityArray e = (EntityArray) entityFactory.getEntity("hypo");
         try {

Modified: commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/EntityParserTestBase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/EntityParserTestBase.java?rev=1301254&r1=1301253&r2=1301254&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/EntityParserTestBase.java
(original)
+++ commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/EntityParserTestBase.java
Thu Mar 15 22:46:50 2012
@@ -16,23 +16,20 @@
  */
 package org.apache.commons.flatfile;
 
-import org.apache.commons.flatfile.Entity;
-import org.apache.commons.flatfile.dsl.ParserEntityFactory;
+import static org.junit.Assert.assertEquals;
 
-import junit.framework.TestCase;
+import org.apache.commons.flatfile.dsl.ParserEntityFactory;
+import org.junit.Before;
 
 /**
  *
  */
-public abstract class EntityParserTestBase extends TestCase {
+public abstract class EntityParserTestBase {
 
     protected ParserEntityFactory entityFactory;
 
-    /*
-     * @see TestCase#setUp()
-     */
-    protected void setUp() throws Exception {
-        super.setUp();
+    @Before
+    public void setUp() throws Exception {
         entityFactory = new ParserEntityFactory(getClass().getResourceAsStream(
                 getSource()));
     }

Modified: commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/FieldOptionsTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/FieldOptionsTest.java?rev=1301254&r1=1301253&r2=1301254&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/FieldOptionsTest.java
(original)
+++ commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/FieldOptionsTest.java
Thu Mar 15 22:46:50 2012
@@ -16,11 +16,16 @@
  */
 package org.apache.commons.flatfile;
 
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+
 /**
  *
  */
 public class FieldOptionsTest extends EntityParserTestBase {
 
+    @Test
     public void test1() {
         assertValue("foo   ", entityFactory.getEntity("field1"));
         assertValue("fooxxx", entityFactory.getEntity("field2"));
@@ -44,11 +49,6 @@ public class FieldOptionsTest extends En
         assertValue("foofoo", entityFactory.getEntity("field16"));
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.pgac.fixedlength.EntityParserTestBase#getSource()
-     */
     protected String getSource() {
         return "fieldOptions.test";
     }

Modified: commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/FillerTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/FillerTest.java?rev=1301254&r1=1301253&r2=1301254&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/FillerTest.java
(original)
+++ commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/FillerTest.java
Thu Mar 15 22:46:50 2012
@@ -16,13 +16,16 @@
  */
 package org.apache.commons.flatfile;
 
-import org.apache.commons.flatfile.EntityMap;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
 
 /**
  *
  */
 public class FillerTest extends EntityParserTestBase {
 
+    @Test
     public void testFiller() throws Exception {
         EntityMap withFiller = (EntityMap) entityFactory
                 .getEntity("withFiller");

Modified: commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/ImmutableTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/ImmutableTest.java?rev=1301254&r1=1301253&r2=1301254&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/ImmutableTest.java
(original)
+++ commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/ImmutableTest.java
Thu Mar 15 22:46:50 2012
@@ -16,14 +16,15 @@
  */
 package org.apache.commons.flatfile;
 
-import org.apache.commons.flatfile.Entity;
-import org.apache.commons.flatfile.IndexedEntityCollection;
-import org.apache.commons.flatfile.NamedEntityCollection;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
 
 /**
  *
  */
 public class ImmutableTest extends EntityParserTestBase {
+    @Test
     public void test1() throws Exception {
         Entity test1 = entityFactory.getEntity("test1");
         assertValue("FOOxBARxBAZ", test1);
@@ -31,6 +32,7 @@ public class ImmutableTest extends Entit
         assertValue("FOOyBARyBAZ", test1);
     }
 
+    @Test
     public void test2() throws Exception {
         Entity test2 = entityFactory.getEntity("test2");
         assertTrue(test2 instanceof IndexedEntityCollection);
@@ -38,6 +40,7 @@ public class ImmutableTest extends Entit
         assertValue("submarine", test2);
     }
 
+    @Test
     public void test3() throws Exception {
         NamedEntityCollection test3 = (NamedEntityCollection) entityFactory
                 .getEntity("test3");
@@ -47,6 +50,7 @@ public class ImmutableTest extends Entit
         assertValue("whatyouworry", test3);
     }
 
+    @Test
     public void test4() throws Exception {
         assertValue("xxxxxxxxxx", entityFactory.getEntity("test4"));
     }

Modified: commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/LengthCheckTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/LengthCheckTest.java?rev=1301254&r1=1301253&r2=1301254&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/LengthCheckTest.java
(original)
+++ commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/LengthCheckTest.java
Thu Mar 15 22:46:50 2012
@@ -16,30 +16,27 @@
  */
 package org.apache.commons.flatfile;
 
-import org.apache.commons.flatfile.EntityFactory;
 import org.apache.commons.flatfile.dsl.ParserEntityFactory;
-
-import junit.framework.TestCase;
+import org.junit.Test;
 
 /**
  *
  */
-public class LengthCheckTest extends TestCase {
+public class LengthCheckTest {
+    @Test
     public void test1() throws Exception {
-        EntityFactory entityFactory = new ParserEntityFactory(getClass()
-                .getResourceAsStream("lengthcheck1.test"));
+        EntityFactory entityFactory =
+            new ParserEntityFactory(getClass().getResourceAsStream(
+                "lengthcheck1.test"));
         entityFactory.getEntity("foo");
         entityFactory.getEntity("bar");
     }
 
+    @Test(expected = IllegalStateException.class)
     public void test2() throws Exception {
-        try {
-            EntityFactory entityFactory = new ParserEntityFactory(getClass()
-                    .getResourceAsStream("lengthcheck2.test"));
-            entityFactory.getEntity("foo");
-            fail("should throw IllegalStateException");
-        } catch (IllegalStateException e) {
-            // okay
-        }
+        EntityFactory entityFactory =
+            new ParserEntityFactory(getClass().getResourceAsStream(
+                "lengthcheck2.test"));
+        entityFactory.getEntity("foo");
     }
 }

Modified: commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/TypesTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/TypesTest.java?rev=1301254&r1=1301253&r2=1301254&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/TypesTest.java
(original)
+++ commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/TypesTest.java
Thu Mar 15 22:46:50 2012
@@ -16,15 +16,16 @@
  */
 package org.apache.commons.flatfile;
 
-import org.apache.commons.flatfile.EntityArray;
-import org.apache.commons.flatfile.EntityMap;
-import org.apache.commons.flatfile.Field;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
 
 /**
  *
  */
 public class TypesTest extends EntityParserTestBase {
 
+    @Test
     public void testTypes() throws Exception {
         // test typedefs
         EntityMap test2 = (EntityMap) entityFactory.getEntity("types");
@@ -98,11 +99,6 @@ public class TypesTest extends EntityPar
         assertEquals(1, test2.getChild("normal").length());
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.pgac.fixedlength.EntityParserTestBase#getSource()
-     */
     protected String getSource() {
         return "types.test";
     }

Modified: commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/ValuesTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/ValuesTest.java?rev=1301254&r1=1301253&r2=1301254&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/ValuesTest.java
(original)
+++ commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/ValuesTest.java
Thu Mar 15 22:46:50 2012
@@ -16,15 +16,16 @@
  */
 package org.apache.commons.flatfile;
 
-import org.apache.commons.flatfile.Entity;
-import org.apache.commons.flatfile.EntityArray;
-import org.apache.commons.flatfile.EntityMap;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
 
 /**
  *
  */
 public class ValuesTest extends EntityParserTestBase {
 
+    @Test
     public void testValues() throws Exception {
         EntityMap values = (EntityMap) entityFactory.getEntity("values");
         assertValue("A", values.getChild("A"));
@@ -51,23 +52,20 @@ public class ValuesTest extends EntityPa
         assertValue("56", array.getChild(2));
     }
 
+    @Test
     public void testImplicitLength() throws Exception {
         Entity e = entityFactory.getEntity("implicitLength");
         assertEquals(12, e.length());
         assertValue("foo-bar-baz!", e);
     }
 
+    @Test
     public void testOverrideChildren() throws Exception {
         Entity e = entityFactory.getEntity("overrideChildren");
         assertEquals(45, e.length());
         assertEquals("", new String(e.getValue()).trim());
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.pgac.fixedlength.EntityParserTestBase#getSource()
-     */
     protected String getSource() {
         return "values.test";
     }

Modified: commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/conversion/BasicConversionTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/conversion/BasicConversionTest.java?rev=1301254&r1=1301253&r2=1301254&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/conversion/BasicConversionTest.java
(original)
+++ commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/conversion/BasicConversionTest.java
Thu Mar 15 22:46:50 2012
@@ -29,11 +29,6 @@ public class BasicConversionTest extends
                         1234567)) };
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.pgac.fixedlength.EntityParserTestBase#getSource()
-     */
     protected String getSource() {
         return "basic.test";
     }

Modified: commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/conversion/ConversionTestBase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/conversion/ConversionTestBase.java?rev=1301254&r1=1301253&r2=1301254&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/conversion/ConversionTestBase.java
(original)
+++ commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/conversion/ConversionTestBase.java
Thu Mar 15 22:46:50 2012
@@ -31,6 +31,8 @@ import org.apache.commons.flatfile.dsl.E
 import org.apache.commons.flatfile.morph.ContainerToIndexedEntityCollectionCopier;
 import org.apache.commons.flatfile.morph.EntityCollectionReflector;
 import org.apache.commons.flatfile.morph.EntityInstantiatingReflector;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  *
@@ -59,12 +61,9 @@ public abstract class ConversionTestBase
 
     protected DecoratedConverter converter;
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.pgac.fixedlength.EntityParserTestBase#setUp()
-     */
-    protected void setUp() throws Exception {
+    @Override
+    @Before
+    public void setUp() throws Exception {
         super.setUp();
         entityFactory.setEntityNameStrategy(getEntityNameStrategy());
         Reflector reflector = new SimpleDelegatingReflector(new Reflector[] {
@@ -80,10 +79,10 @@ public abstract class ConversionTestBase
         converter = sdt;
     }
 
+    @Test
     public void testMe() throws Exception {
-        TestPair[] pairs = getTestPairs();
-        for (int i = 0; i < pairs.length; i++) {
-            assertConversion(pairs[i]);
+        for (TestPair p : getTestPairs()) {
+            assertConversion(p);
         }
     }
 

Modified: commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/morph/TextToByteConverterTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/morph/TextToByteConverterTest.java?rev=1301254&r1=1301253&r2=1301254&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/morph/TextToByteConverterTest.java
(original)
+++ commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/morph/TextToByteConverterTest.java
Thu Mar 15 22:46:50 2012
@@ -19,14 +19,15 @@
  */
 package org.apache.commons.flatfile.morph;
 
-import org.apache.commons.flatfile.morph.TextToByteConverter;
+import static org.junit.Assert.assertEquals;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
 /**
  *
  */
-public class TextToByteConverterTest extends TestCase {
+public class TextToByteConverterTest {
+    @Test
     public void test1() throws Exception {
         TextToByteConverter cnv = new TextToByteConverter();
         assertEquals((byte) 'a', ((Byte) cnv.convert(Byte.class, "a"))



Mime
View raw message