Author: mbenson
Date: Fri Oct 21 23:43:36 2016
New Revision: 1766168

URL: http://svn.apache.org/viewvc?rev=1766168&view=rev
Log:
split long test methods into smaller ones; reordered template methods in test 
source files; formatted some files for line length

Modified:
    
commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/EntityArray.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/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/RunParser.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/conversion/NestedConversionTest.java
    
commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/morph/TextToByteConverterTest.java

Modified: 
commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/EntityArray.java
URL: 
http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/EntityArray.java?rev=1766168&r1=1766167&r2=1766168&view=diff
==============================================================================
--- 
commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/EntityArray.java
 (original)
+++ 
commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/EntityArray.java
 Fri Oct 21 23:43:36 2016
@@ -160,20 +160,15 @@ public class EntityArray extends EntityC
      * Initialize this EntityArray.
      */
     private synchronized void initialize() {
-        if (children != null) {
-            return;
+        if (children == null) {
+            Validate.validState(size >= 0, "EntityArray size not set");
+            if (size == 0) {
+                children = Collections.<Entity<?>> emptyList();
+                return;
+            }
+            Validate.validState(prototype != null, "Prototype child entity not 
set");
+            children = new ArrayList<Entity<?>>(size);
         }
-        if (size < 0) {
-            throw new IllegalStateException("EntityArray size not set");
-        }
-        if (size == 0) {
-            children = Collections.<Entity<?>> emptyList();
-            return;
-        }
-        if (prototype == null) {
-            throw new IllegalStateException("Prototype child entity not set");
-        }
-        children = new ArrayList<Entity<?>>(size);
         adjustSize();
     }
 

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=1766168&r1=1766167&r2=1766168&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
 Fri Oct 21 23:43:36 2016
@@ -23,6 +23,10 @@ import org.junit.Test;
  */
 public class DefaultOptionsTest extends EntityParserTestBase {
 
+    protected String getSource() {
+        return "defaultOptions.test";
+    }
+
     @Test
     public void test1() {
         assertValue("@@@foo", entityFactory.getEntity("field1"));
@@ -33,7 +37,4 @@ public class DefaultOptionsTest extends
         assertValue("&foo&&", entityFactory.getEntity("field6"));
     }
 
-    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=1766168&r1=1766167&r2=1766168&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
 Fri Oct 21 23:43:36 2016
@@ -22,25 +22,24 @@ import org.junit.Test;
  *
  */
 public class DelimiterTest extends EntityParserTestBase {
+
+    protected String getSource() {
+        return "delimiter.test";
+    }
+
     @Test
     public void test1() throws Exception {
-        StringBuffer buf = new StringBuffer("XX");
+        StringBuilder buf = new StringBuilder("XX");
         for (int i = 0; i < 9; i++) {
             buf.append("\r\nXX");
         }
         assertValue(buf.toString(), entityFactory.getEntity("array38"));
-        assertValue(buf.append("\r\n").toString(), entityFactory
-                .getEntity("array40"));
+        assertValue(buf.append("\r\n").toString(), 
entityFactory.getEntity("array40"));
         assertValue("foo\r\nbar\r\nbaz", entityFactory.getEntity("map13"));
         assertValue("foo\r\nbar\r\nbaz\r\n", entityFactory.getEntity("map15"));
-        assertValue("foo\r\nbar\r\nwhy\r\nbaz", entityFactory
-                .getEntity("map18"));
-        assertValue("foo\r\nbar\r\nwhy\r\nbaz\r\n", entityFactory
-                .getEntity("map20"));
+        assertValue("foo\r\nbar\r\nwhy\r\nbaz", 
entityFactory.getEntity("map18"));
+        assertValue("foo\r\nbar\r\nwhy\r\nbaz\r\n", 
entityFactory.getEntity("map20"));
         assertValue("foo bar baz\r\nfoo bar baz\r\nfoo bar baz\r\n", 
entityFactory.getEntity("map39"));
     }
 
-    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=1766168&r1=1766167&r2=1766168&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
 Fri Oct 21 23:43:36 2016
@@ -40,6 +40,10 @@ public class DynamicFieldTest extends En
         Arrays.fill(LARGE_BYTES, (byte) 'a');
     }
 
+    protected String getSource() {
+        return "dynamicField.test";
+    }
+
     @Test
     public void test1() throws Exception {
         DynamicField df = entityFactory.getEntity("df1");
@@ -208,8 +212,4 @@ public class DynamicFieldTest extends En
         }
     }
 
-    protected String getSource() {
-        return "dynamicField.test";
-    }
-
 }

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=1766168&r1=1766167&r2=1766168&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
 Fri Oct 21 23:43:36 2016
@@ -19,75 +19,117 @@ package org.apache.commons.flatfile;
 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 {
 
+    protected String getSource() {
+        return "entityarraylifecycle.test";
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void testIllegalStateBeforeSizeSet() throws Exception {
+        entityFactory.getEntity("hypo").getValue();
+    }
+
     @Test
-    public void testMe() throws Exception {
-        EntityArray e = entityFactory.getEntity("hypo");
-        try {
-            e.getValue();
-            fail("should fail");
-        } catch (IllegalStateException ise) {
-            // okay
-        }
+    public void testFillAfterSizeSet() throws Exception {
+        final EntityArray e = entityFactory.getEntity("hypo");
         assertTrue(e.isSizable());
         e.setSize(5);
         e.fill((byte) 'a');
         assertValue("aaaaaaaaaa", e);
-        e = entityFactory.getEntity("hypo");
+        assertFalse(e.isSizable());
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void testModifyNonResizableSize() throws Exception {
+        final EntityArray e = entityFactory.getEntity("hypo");
+        e.setSize(5);
+        e.setSize(2);
+    }
+
+    @Test
+    public void testModifyResizable() throws Exception {
+        final EntityArray e = entityFactory.getEntity("hypo");
+        assertTrue(e.isSizable());
+        e.setSize(5);
+        e.fill((byte) 'a');
+        assertValue("aaaaaaaaaa", e);
+        assertFalse(e.isSizable());
+        e.setResizable(true);
         assertTrue(e.isSizable());
         e.setSize(2);
         e.fill((byte) 'b');
         assertValue("bbbb", e);
-        e = entityFactory.getEntity("complete");
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void testCannotChangeSizeOfNonSizable() throws Exception {
+        final EntityArray e = entityFactory.getEntity("complete");
+        assertFalse(e.isSizable());
+        e.setSize(e.size() + 1);
+    }
+
+    @Test
+    public void testIgnoreSetSameSize() throws Exception {
+        final EntityArray e = entityFactory.getEntity("complete");
         assertFalse(e.isSizable());
-        expectInvalidSize(e, e.size() + 1,
-                "should fail to set size of completed entity",
-                IllegalStateException.class);
         e.setSize(e.size());
-        e = entityFactory.getEntity("rangeMin1");
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testSetSizeBelowMinimum() throws Exception {
+        final EntityArray e = entityFactory.getEntity("rangeMin1");
+        assertTrue(e.isSizable());
+        e.setSize(0);
+    }
+
+    @Test
+    public void testSetValidSize() throws Exception {
+        final EntityArray e = entityFactory.getEntity("rangeMin1");
         assertTrue(e.isSizable());
-        expectInvalidSize(e, 0, "should fail to set size < 1",
-                IllegalArgumentException.class);
         e.setSize(665);
         assertEquals(665, e.size());
-        e = entityFactory.getEntity("explicitRange");
-        expectInvalidSize(e, 0, "should fail to set size < 1",
-                IllegalArgumentException.class);
-        expectInvalidSize(e, 4, "should fail to set size > 4",
-                IllegalArgumentException.class);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testSetSizeBelowMinimumFullySpecified() throws Exception {
+        final EntityArray e = entityFactory.getEntity("explicitRange");
+        e.setSize(0);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testSetSizeAboveMaximumFullySpecified() throws Exception {
+        final EntityArray e = entityFactory.getEntity("explicitRange");
+        e.setSize(5);
+    }
+
+    @Test
+    public void testSetAcceptableSizeFullySpecified() throws Exception {
+        final EntityArray e = entityFactory.getEntity("explicitRange");
         e.setSize(3);
         assertEquals(3, e.size());
-        e = entityFactory.getEntity("optional");
+    }
+
+    @Test
+    public void testOptional() throws Exception {
+        final EntityArray e = entityFactory.getEntity("optional");
         assertEquals(0, e.getMinimumSize());
         assertEquals(1, e.getMaximumSize());
         e.setSize(0);
         assertEquals(0, e.size());
         assertEquals(0, e.getValue().length);
-        e = entityFactory.getEntity("optional2");
+    }
+
+    @Test
+    public void testOptional2() throws Exception {
+        final EntityArray e = entityFactory.getEntity("optional2");
         assertEquals(0, e.getMinimumSize());
         assertEquals(1, e.getMaximumSize());
         e.setSize(0);
         assertEquals(0, e.size());
         assertEquals(0, e.getValue().length);
     }
-
-    private void expectInvalidSize(EntityArray e, int size,
-            String failureMessage, Class<? extends Exception> exceptionType) {
-        try {
-            e.setSize(size);
-            fail(failureMessage);
-        } catch (Exception exc) {
-            assertTrue("Unexpected exception " + exc, exceptionType == null
-                    || exceptionType.isInstance(exc));
-        }
-    }
-
-    protected String getSource() {
-        return "entityarraylifecycle.test";
-    }
 }

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=1766168&r1=1766167&r2=1766168&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
 Fri Oct 21 23:43:36 2016
@@ -16,40 +16,119 @@
  */
 package org.apache.commons.flatfile;
 
-import static org.junit.Assert.fail;
-
 import org.junit.Test;
 
-/**
- *
- */
 public class FieldOptionsTest extends EntityParserTestBase {
 
+    protected String getSource() {
+        return "fieldOptions.test";
+    }
+
+    //    field1 (6) "foo"
     @Test
-    public void test1() {
+    public void testDefaultPadDefaultJustify() {
         assertValue("foo   ", entityFactory.getEntity("field1"));
+    }
+
+    //    field2 (6) pad='x' "foo"
+    @Test
+    public void testXPadDefaultJustify() {
         assertValue("fooxxx", entityFactory.getEntity("field2"));
+    }
+
+    //    field3 (6) pad='x' justify=LEFT "foo"
+    @Test
+    public void testXPadLeftJustify() {
         assertValue("fooxxx", entityFactory.getEntity("field3"));
+    }
+
+    //    field4 (6) pad='x' justify=RIGHT "foo"
+    @Test
+    public void testXPadRightJustify() {
         assertValue("xxxfoo", entityFactory.getEntity("field4"));
+    }
+
+    //    field5 (6) pad='x' justify=CENTER "foo"
+    @Test
+    public void testXPadCenterJustify() {
         assertValue("xfooxx", entityFactory.getEntity("field5"));
-        try {
-            assertValue("fo", entityFactory.getEntity("field6"));
-            fail("value foo too big and overflow = default (error)");
-        } catch (IllegalArgumentException e) {
-        }
+    }
+
+    //    field6 (2) justify=CENTER "foo"
+    @Test(expected = IllegalArgumentException.class)
+    public void testDefaultOverflowCenterJustify() {
+        assertValue("fo", entityFactory.getEntity("field6"));
+    }
+
+    //    field7 (2) justify=CENTER overflow=TRUNCATE "foo"
+    //    field8 (2) justify=CENTER overflow=TRUNCATE "foobar"
+    @Test
+    public void testTruncateOverflowCenterJustify() {
         assertValue("fo", entityFactory.getEntity("field7"));
         assertValue("ob", entityFactory.getEntity("field8"));
+    }
+
+    //    field9 (3) justify=LEFT overflow=TRUNCATE "fool"
+    @Test
+    public void testTruncateOverflowLeftJustify() {
         assertValue("foo", entityFactory.getEntity("field9"));
+    }
+
+    //    field10 (3) justify=RIGHT overflow=TRUNCATE "fowl"
+    @Test
+    public void testTruncateOverflowRightJustify() {
         assertValue("owl", entityFactory.getEntity("field10"));
+    }
+
+    //    field11 (5) justify=RIGHT pad='0' "3.14"
+    @Test
+    public void testZeroPadRightJustify() {
         assertValue("03.14", entityFactory.getEntity("field11"));
+    }
+
+    /*
+        field12 { //you'll see that we can set nested values now too because 
we are so cool!
+            foo (3)
+            ? ' '!
+            bar (3)
+        } "childMap[foo].value"=foo bar=bar
+     */
+    @Test
+    public void testValueUsingOptionSyntaxTwoWays() {
         assertValue("foo bar", entityFactory.getEntity("field12"));
+    }
+
+    /*
+        field13 { //added @ syntax to override auto translation of 
non-collection entities to strings
+            foo (3)
+            ? ' '!
+            bar (3)
+        } "@foo.value"=foo "@bar.justify"=RIGHT bar=b
+     */
+    @Test
+    public void testAmpersandSyntaxToSetNonCollectionChildOptions() {
         assertValue("foo   b", entityFactory.getEntity("field13"));
+    }
+
+    /*
+        field14 {
+            foo (3)
+        } [2] "@prototype.foo"=foo
+     */
+    @Test
+    public void testSetArrayPrototypeChildValue() {
         assertValue("foofoo", entityFactory.getEntity("field14"));
+    }
+
+    //    field15 (3) [2] prototype=foo
+    @Test
+    public void testSetArrayPrototypeValue() {
         assertValue("foofoo", entityFactory.getEntity("field15"));
-        assertValue("foofoo", entityFactory.getEntity("field16"));
     }
 
-    protected String getSource() {
-        return "fieldOptions.test";
+    //    field16 (3) [2] "@prototype.value"=foo
+    @Test
+    public void testSetArrayPrototypeValueUsingAmpersand() {
+        assertValue("foofoo", entityFactory.getEntity("field16"));
     }
 }

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=1766168&r1=1766167&r2=1766168&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
 Fri Oct 21 23:43:36 2016
@@ -25,6 +25,10 @@ import org.junit.Test;
  */
 public class FillerTest extends EntityParserTestBase {
 
+    protected String getSource() {
+        return "filler.test";
+    }
+
     @Test
     public void testFiller() throws Exception {
         EntityMap withFiller = entityFactory.getEntity("withFiller");
@@ -32,8 +36,4 @@ public class FillerTest extends EntityPa
         assertValue("foo bar---nothing-goes-here---baz", withFiller);
     }
 
-    protected String getSource() {
-        return "filler.test";
-    }
-
 }

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=1766168&r1=1766167&r2=1766168&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
 Fri Oct 21 23:43:36 2016
@@ -24,6 +24,13 @@ import org.junit.Test;
  *
  */
 public class ImmutableTest extends EntityParserTestBase {
+    /**
+     * {@inheritDoc}
+     */
+    protected String getSource() {
+        return "immutable.test";
+    }
+
     @Test
     public void test1() throws Exception {
         Entity<?> test1 = entityFactory.getEntity("test1");
@@ -55,10 +62,4 @@ public class ImmutableTest extends Entit
         assertValue("xxxxxxxxxx", entityFactory.getEntity("test4"));
     }
 
-    /**
-     * {@inheritDoc}
-     */
-    protected String getSource() {
-        return "immutable.test";
-    }
 }

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=1766168&r1=1766167&r2=1766168&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
 Fri Oct 21 23:43:36 2016
@@ -19,24 +19,17 @@ package org.apache.commons.flatfile;
 import org.apache.commons.flatfile.dsl.ParserEntityFactory;
 import org.junit.Test;
 
-/**
- *
- */
 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 {
-        EntityFactory entityFactory =
-            new ParserEntityFactory(getClass().getResourceAsStream(
-                "lengthcheck2.test"));
+        EntityFactory entityFactory = new 
ParserEntityFactory(getClass().getResourceAsStream("lengthcheck2.test"));
         entityFactory.getEntity("foo");
     }
 }

Modified: 
commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/RunParser.java
URL: 
http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/RunParser.java?rev=1766168&r1=1766167&r2=1766168&view=diff
==============================================================================
--- 
commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/RunParser.java
 (original)
+++ 
commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/RunParser.java
 Fri Oct 21 23:43:36 2016
@@ -21,13 +21,10 @@ import antlr.TokenBuffer;
 import org.apache.commons.flatfile.dsl.EntityLexer;
 import org.apache.commons.flatfile.dsl.EntityParser;
 
-/**
- *
- */
 public class RunParser {
     public static void main(String[] args) throws Exception {
-        EntityParser p = new EntityParser(new TokenBuffer(new EntityLexer(
-                RunParser.class.getResourceAsStream("fieldOptions.test"))));
+        EntityParser p = new EntityParser(
+            new TokenBuffer(new 
EntityLexer(RunParser.class.getResourceAsStream("fieldOptions.test"))));
         p.parse();
     }
 }

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=1766168&r1=1766167&r2=1766168&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
 Fri Oct 21 23:43:36 2016
@@ -20,10 +20,10 @@ import static org.junit.Assert.assertEqu
 
 import org.junit.Test;
 
-/**
- *
- */
 public class TypesTest extends EntityParserTestBase {
+    protected String getSource() {
+        return "types.test";
+    }
 
     @Test
     public void testTypes() throws Exception {
@@ -99,7 +99,4 @@ public class TypesTest extends EntityPar
         assertEquals(1, test2.getChild("normal").length());
     }
 
-    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=1766168&r1=1766167&r2=1766168&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
 Fri Oct 21 23:43:36 2016
@@ -20,11 +20,12 @@ import static org.junit.Assert.assertEqu
 
 import org.junit.Test;
 
-/**
- *
- */
 public class ValuesTest extends EntityParserTestBase {
 
+    protected String getSource() {
+        return "values.test";
+    }
+
     @Test
     public void testValues() throws Exception {
         EntityMap values = entityFactory.getEntity("values");
@@ -65,7 +66,4 @@ public class ValuesTest extends EntityPa
         assertEquals("", new String(e.getValue()).trim());
     }
 
-    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=1766168&r1=1766167&r2=1766168&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
 Fri Oct 21 23:43:36 2016
@@ -16,20 +16,16 @@
  */
 package org.apache.commons.flatfile.conversion;
 
-/**
- *
- */
 public class BasicConversionTest extends ConversionTestBase {
 
-    protected TestPair[] getTestPairs() {
-        return new TestPair[] {
-                new TestPair("abcdefghij;123456", new Foo("abcdefghij", 
123456)),
-                new TestPair("abcdefg   ;012345", new Foo("abcdefg", 12345)),
-                new TestPair("abcdefghij;234567", new Foo("abcdefghijk",
-                        1234567)) };
-    }
-
     protected String getSource() {
         return "basic.test";
     }
+
+    protected TestPair[] getTestPairs() {
+        return new TestPair[] { new TestPair("abcdefghij;123456", new 
Foo("abcdefghij", 123456)),
+            new TestPair("abcdefg   ;012345", new Foo("abcdefg", 12345)),
+            new TestPair("abcdefghij;234567", new Foo("abcdefghijk", 1234567)) 
};
+    }
+
 }

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=1766168&r1=1766167&r2=1766168&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
 Fri Oct 21 23:43:36 2016
@@ -33,9 +33,6 @@ import org.apache.commons.flatfile.morph
 import org.junit.Before;
 import org.junit.Test;
 
-/**
- *
- */
 public abstract class ConversionTestBase extends EntityParserTestBase {
     private static final EntityNameStrategy DEFAULT_NAME_STRATEGY = new 
DefaultEntityNameStrategy();
 
@@ -72,9 +69,7 @@ public abstract class ConversionTestBase
         entityCopier.setDestinationClasses(new Class[] { Entity.class });
         entityCopier.setReflector(reflector);
         SimpleDelegatingTransformer sdt = new SimpleDelegatingTransformer(
-                new Transformer[] {
-                        new ContainerToIndexedEntityCollectionCopier(),
-                        entityCopier }, true);
+            new Transformer[] { new 
ContainerToIndexedEntityCollectionCopier(), entityCopier }, true);
         converter = sdt;
     }
 

Modified: 
commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/conversion/NestedConversionTest.java
URL: 
http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/conversion/NestedConversionTest.java?rev=1766168&r1=1766167&r2=1766168&view=diff
==============================================================================
--- 
commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/conversion/NestedConversionTest.java
 (original)
+++ 
commons/sandbox/flatfile/trunk/src/test/java/org/apache/commons/flatfile/conversion/NestedConversionTest.java
 Fri Oct 21 23:43:36 2016
@@ -17,9 +17,13 @@
 package org.apache.commons.flatfile.conversion;
 
 public class NestedConversionTest extends ConversionTestBase {
+    protected String getSource() {
+        return "nested.test";
+    }
+
     protected TestPair[] getTestPairs() {
-        Foo[] foos = new Foo[] { new Foo("abcdefghij", 123456),
-                new Foo("abcdefg", 12345), new Foo("abcdefghijk", 1234567) };
+        Foo[] foos =
+            new Foo[] { new Foo("abcdefghij", 123456), new Foo("abcdefg", 
12345), new Foo("abcdefghijk", 1234567) };
         Bar bar1 = new Bar();
         bar1.setFoos(foos);
         bar1.setX("X");
@@ -33,14 +37,8 @@ public class NestedConversionTest extend
         bar3.setX("x");
         bar3.setY("y");
         bar3.setFoos(null);
-        return new TestPair[] {
-                new TestPair(
-                        "Xabcdefghij;123456abcdefg   
;012345abcdefghij;234567Y",
-                        bar1), new TestPair("XY", bar2),
-                new TestPair("xy", bar3) };
+        return new TestPair[] { new TestPair("Xabcdefghij;123456abcdefg   
;012345abcdefghij;234567Y", bar1),
+            new TestPair("XY", bar2), new TestPair("xy", bar3) };
     }
 
-    protected String getSource() {
-        return "nested.test";
-    }
 }

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=1766168&r1=1766167&r2=1766168&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
 Fri Oct 21 23:43:36 2016
@@ -14,26 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/**
- * 
- */
+
 package org.apache.commons.flatfile.morph;
 
 import static org.junit.Assert.assertEquals;
 
 import org.junit.Test;
 
-/**
- *
- */
 public class TextToByteConverterTest {
     @Test
     public void test1() throws Exception {
         TextToByteConverter cnv = new TextToByteConverter();
-        assertEquals((byte) 'a', ((Byte) cnv.convert(Byte.class, "a"))
-                .byteValue());
-        assertEquals((byte) 'a', ((Byte) cnv.convert(Byte.class, "asinine"))
-                .byteValue());
+        assertEquals((byte) 'a', ((Byte) cnv.convert(Byte.class, 
"a")).byteValue());
+        assertEquals((byte) 'a', ((Byte) cnv.convert(Byte.class, 
"asinine")).byteValue());
         assertEquals("a", cnv.convert(String.class, new Byte((byte) 'a')));
     }
 }


Reply via email to