harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r479418 [35/43] - in /harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common: javax/swing/ javax/swing/border/ javax/swing/colorchooser/ javax/swing/event/ javax/swing/filechooser/ javax/swing/plaf/ javax/swing/plaf/basic/ j...
Date Sun, 26 Nov 2006 20:15:55 GMT
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/PlainView_ChangesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/PlainView_ChangesTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/PlainView_ChangesTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/PlainView_ChangesTest.java Sun Nov 26 12:15:43 2006
@@ -25,7 +25,6 @@
 import java.awt.Rectangle;
 import java.awt.Shape;
 import java.awt.geom.Rectangle2D;
-
 import javax.swing.BasicSwingTestCase;
 import javax.swing.JTextArea;
 import javax.swing.event.DocumentEvent;
@@ -45,60 +44,70 @@
 public class PlainView_ChangesTest extends BasicSwingTestCase {
     static final class LineRange {
         public Component host;
-        public int       line0;
-        public int       line1;
-        public Shape     shape;
 
-        public LineRange(final int line0, final int line1,
-                         final Shape shape, final Component host) {
+        public int line0;
+
+        public int line1;
+
+        public Shape shape;
+
+        public LineRange(final int line0, final int line1, final Shape shape,
+                final Component host) {
             this.line0 = line0;
             this.line1 = line1;
             this.shape = shape;
-            this.host  = host;
+            this.host = host;
         }
 
         /**
          * Checks that fields have expected values.
          */
-        public void check(final int s, final int e,
-                          final Shape a, final Container container) {
+        public void check(final int s, final int e, final Shape a, final Container container) {
             assertEquals("Unexpected start line", s, line0);
-            assertEquals("Unexpected end line",   e, line1);
+            assertEquals("Unexpected end line", e, line1);
             assertSame("Unexpected shape", a, shape);
             assertSame("Unexpected container/host", container, host);
         }
     }
 
     static final class PreferenceChange {
-        public boolean   height;
-        public boolean   width;
+        public boolean height;
+
+        public boolean width;
 
         public PreferenceChange(final boolean width, final boolean height) {
-            this.width  = width;
+            this.width = width;
             this.height = height;
         }
 
         public void check(final boolean width, final boolean height) {
-            assertEquals("Width has unexpected value",
-                         width,  this.width);
-            assertEquals("Height has unexpected value",
-                         height, this.height);
+            assertEquals("Width has unexpected value", width, this.width);
+            assertEquals("Height has unexpected value", height, this.height);
         }
     }
 
     private boolean callSuperDamageRange;
+
     private boolean callSuperUpdateDamage;
+
     private Container container;
 
     private Document doc;
+
     private DocumentEvent event;
 
     private ViewFactory factory;
+
     private LineRange lineRange;
+
     private Rectangle paintRect;
+
     private PreferenceChange preferenceChange;
+
     private Element root;
+
     private Shape shape;
+
     private boolean updateDamageCalled;
 
     private PlainView view;
@@ -111,31 +120,23 @@
     public void testDamageLineRange() {
         view.updateMetrics();
         final int height = view.metrics.getHeight();
-        final int y      = 300;
-
+        final int y = 300;
         callSuperDamageRange = true;
         shape = new Rectangle(200, y, 300, 500);
-
         view.damageLineRange(0, 0, shape, view.getContainer());
         assertTrue(paintRect.equals(new Rectangle(200, y, 300, height)));
         assertTrue(paintRect.equals(view.lineToRect(shape, 0)));
         paintRect = null;
-
         view.damageLineRange(1, 1, shape, view.getContainer());
-        assertTrue(paintRect.equals(new Rectangle(200, y + height,
-                                                  300, height)));
+        assertTrue(paintRect.equals(new Rectangle(200, y + height, 300, height)));
         assertTrue(paintRect.equals(view.lineToRect(shape, 1)));
         paintRect = null;
-
         view.damageLineRange(2, 2, shape, view.getContainer());
-        assertTrue(paintRect.equals(new Rectangle(200, y + height * 2,
-                                                  300, height)));
+        assertTrue(paintRect.equals(new Rectangle(200, y + height * 2, 300, height)));
         assertTrue(paintRect.equals(view.lineToRect(shape, 2)));
         paintRect = null;
-
         view.damageLineRange(0, 2, shape, view.getContainer());
-        assertEquals(new Rectangle(200, 300, 300, 3 * height),
-                     paintRect);
+        assertEquals(new Rectangle(200, 300, 300, 3 * height), paintRect);
         Rectangle r0 = view.lineToRect(shape, 0);
         Rectangle r1 = view.lineToRect(shape, 1);
         Rectangle r2 = view.lineToRect(shape, 2);
@@ -156,14 +157,10 @@
     public void testLineToRect() {
         view.updateMetrics();
         final int height = view.metrics.getHeight();
-        assertEquals(new Rectangle(0, 0, 500, height),
-                     view.lineToRect(shape, 0));
-        assertEquals(new Rectangle(0, height, 500, height),
-                     view.lineToRect(shape, 1));
-
-        assertEquals(new Rectangle(30, 50 + height, 70, height),
-                view.lineToRect(shape =
-                    new Rectangle2D.Float(30f, 50f, 70f, 10f), 1));
+        assertEquals(new Rectangle(0, 0, 500, height), view.lineToRect(shape, 0));
+        assertEquals(new Rectangle(0, height, 500, height), view.lineToRect(shape, 1));
+        assertEquals(new Rectangle(30, 50 + height, 70, height), view.lineToRect(
+                shape = new Rectangle2D.Float(30f, 50f, 70f, 10f), 1));
     }
 
     /**
@@ -173,10 +170,8 @@
         // Set tab size to 4
         doc.putProperty(PlainDocument.tabSizeAttribute, new Integer(4));
         assertEquals(4, view.getTabSize());
-
         // Update metrics 'cause view state isn't fully initialized yet
         view.updateMetrics();
-
         float tabPos = view.getTabSize() * view.metrics.charWidth('m');
         // Test tab stop positions
         assertEquals(tabPos, view.nextTabStop(0.0f, 0), 0.00001f);
@@ -191,10 +186,8 @@
         // Set tab size to -4
         doc.putProperty(PlainDocument.tabSizeAttribute, new Integer(-4));
         assertEquals(-4, view.getTabSize());
-
         // Update metrics 'cause view state isn't fully initialized yet
         view.updateMetrics();
-
         float tabPos = view.getTabSize() * view.metrics.charWidth('m');
         // Test tab stop positions
         assertEquals(tabPos, view.nextTabStop(0.0f, 0), 0.00001f);
@@ -211,16 +204,13 @@
         // Set tab size to 0
         doc.putProperty(PlainDocument.tabSizeAttribute, new Integer(0));
         assertEquals(0, view.getTabSize());
-
         // Update metrics 'cause view state isn't fully initialized yet
         view.updateMetrics();
-
         float tabPos = view.getTabSize() * view.metrics.charWidth('m');
         assertEquals(0.0f, tabPos, 0.00001f);
         // Test tab stop positions
         assertEquals(tabPos, view.nextTabStop(0.0f, 0), 0.00001f);
-        assertEquals(tabPos + 0.2f,
-                     view.nextTabStop(tabPos + 0.2f, 0), 0.00001f);
+        assertEquals(tabPos + 0.2f, view.nextTabStop(tabPos + 0.2f, 0), 0.00001f);
         assertEquals(4.75f, view.nextTabStop(4.75f, 0), 0.00001f);
     }
 
@@ -238,41 +228,44 @@
         //                   0123456 789 012345678
         view.updateDamage(event, shape, factory);
         assertNull(lineRange);
-        preferenceChange.check(true, true);   preferenceChange = null;
-
+        preferenceChange.check(true, true);
+        preferenceChange = null;
         doc.insertString(14, "0123210", null);
         view.updateDamage(event, shape, factory);
-        lineRange.check(2, 2, shape, container);      lineRange = null;
-        preferenceChange.check(true, false);   preferenceChange = null;
-
+        lineRange.check(2, 2, shape, container);
+        lineRange = null;
+        preferenceChange.check(true, false);
+        preferenceChange = null;
         doc.insertString(14, "\n", null);
         view.updateDamage(event, shape, factory);
         if (!isHarmony()) {
             assertNull(lineRange);
         } else {
-            lineRange.check(2, 3, shape, container); lineRange = null;
+            lineRange.check(2, 3, shape, container);
+            lineRange = null;
         }
-        preferenceChange.check(true, true);   preferenceChange = null;
-
+        preferenceChange.check(true, true);
+        preferenceChange = null;
         doc.insertString(15, "\n", null);
         view.updateDamage(event, shape, factory);
         if (!isHarmony()) {
             assertNull(lineRange);
         } else {
-            lineRange.check(2, 4, shape, container); lineRange = null;
+            lineRange.check(2, 4, shape, container);
+            lineRange = null;
         }
         preferenceChange.check(isHarmony() ? false : true, true);
-                                              preferenceChange = null;
-
+        preferenceChange = null;
         doc.insertString(15, "line1\nline2 change\nline3", null);
         view.updateDamage(event, shape, factory);
         if (!isHarmony()) {
             assertNull(lineRange);
         } else {
-            lineRange.check(2, 6, shape, container); lineRange = null;
+            lineRange.check(2, 6, shape, container);
+            lineRange = null;
         }
         preferenceChange.check(isHarmony() ? false : true, true);
-                                              preferenceChange = null;
+        preferenceChange = null;
     }
 
     /**
@@ -282,26 +275,24 @@
         createEvent();
         doc.insertString(0, "1:0123\n2:\n3:abcdefg", null);
         //                   0123456 789 012345678
-
         // Update view
         assertNull(preferenceChange);
         view.updateDamage(event, shape, factory);
         assertNull(lineRange);
-        preferenceChange.check(true, true);   preferenceChange = null;
-
+        preferenceChange.check(true, true);
+        preferenceChange = null;
         // The widest line doesn't change, and line number neither
-        doc.remove(2, 2);    // "01" => "1:23\n2:\n3:..."
+        doc.remove(2, 2); // "01" => "1:23\n2:\n3:..."
         view.updateDamage(event, shape, factory);
-        lineRange.check(0, 0, shape, container); lineRange = null;
+        lineRange.check(0, 0, shape, container);
+        lineRange = null;
         assertNull(preferenceChange);
-
         // The widest line doesn't change, but line number changes
-        doc.remove(4, 1);   // "\n" => "1:232:\n3:..."
+        doc.remove(4, 1); // "\n" => "1:232:\n3:..."
         view.updateDamage(event, shape, factory);
         assertNull(lineRange);
         preferenceChange.check(isHarmony() ? false : true, true);
-                                              preferenceChange = null;
-
+        preferenceChange = null;
         // Again the widest line doesn't change, and line number stays the same
         doc.remove(4, 2);
         view.updateDamage(event, shape, factory);
@@ -316,33 +307,29 @@
         createEvent();
         doc.insertString(0, "1:0123\n2:\n3:abcdefg", null);
         //                   0123456 789 012345678
-
         // Update view
         assertNull(preferenceChange);
         view.updateDamage(event, shape, factory);
         assertNull(lineRange);
-        preferenceChange.check(true, true);   preferenceChange = null;
-
-        event = ((AbstractDocument)doc).new DefaultDocumentEvent(3, 14,
+        preferenceChange.check(true, true);
+        preferenceChange = null;
+        event = ((AbstractDocument) doc).new DefaultDocumentEvent(3, 14,
                 DocumentEvent.EventType.CHANGE);
         view.updateDamage(event, shape, factory);
-        lineRange.check(0, 0, shape, container);   lineRange = null;
+        lineRange.check(0, 0, shape, container);
+        lineRange = null;
         assertNull(preferenceChange);
-
-
-        event = ((AbstractDocument)doc).new DefaultDocumentEvent(7, 12,
+        event = ((AbstractDocument) doc).new DefaultDocumentEvent(7, 12,
                 DocumentEvent.EventType.CHANGE);
         view.updateDamage(event, shape, factory);
-        lineRange.check(1, 1, shape, container);   lineRange = null;
+        lineRange.check(1, 1, shape, container);
+        lineRange = null;
         assertNull(preferenceChange);
-
-
         // We remove the first and second lines, but the widest one isn't
         // changed, therefore the preferred width is not changed
-        ElementEdit ee = new ElementEdit(root, 0, null,
-                                         new Element[] {root.getElement(0),
-                                                        root.getElement(1)});
-        ((DefaultDocumentEvent)event).addEdit(ee);
+        ElementEdit ee = new ElementEdit(root, 0, null, new Element[] { root.getElement(0),
+                root.getElement(1) });
+        ((DefaultDocumentEvent) event).addEdit(ee);
         view.updateDamage(event, shape, factory);
         assertNull(lineRange);
         preferenceChange.check(isHarmony() ? false : true, true);
@@ -355,17 +342,20 @@
         assertNull(preferenceChange);
     }
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
-
-        doc  = new PlainDocument();
+        doc = new PlainDocument();
         root = doc.getDefaultRootElement();
         view = new PlainView(root) {
+            @Override
             public Container getContainer() {
                 if (container == null) {
                     container = new JTextArea() {
-                        public void repaint(final int x, final int y,
-                                            final int w, final int h) {
+                        private static final long serialVersionUID = 1L;
+
+                        @Override
+                        public void repaint(final int x, final int y, final int w, final int h) {
                             if (paintRect == null) {
                                 paintRect = new Rectangle(x, y, w, h);
                             } else {
@@ -374,21 +364,20 @@
                         }
                     };
                 }
-
                 return container;
             }
 
-            public void preferenceChanged(final View child,
-                                          final boolean width,
-                                          final boolean height) {
+            @Override
+            public void preferenceChanged(final View child, final boolean width,
+                    final boolean height) {
                 preferenceChange = new PreferenceChange(width, height);
                 assertNull(child);
                 super.preferenceChanged(child, width, height);
             }
 
-            protected void damageLineRange(final int line0, final int line1,
-                                           final Shape shape,
-                                           final Component host) {
+            @Override
+            protected void damageLineRange(final int line0, final int line1, final Shape shape,
+                    final Component host) {
                 if (callSuperDamageRange) {
                     super.damageLineRange(line0, line1, shape, host);
                 } else {
@@ -396,9 +385,9 @@
                 }
             }
 
-            protected void updateDamage(final DocumentEvent changes,
-                                        final Shape a,
-                                        final ViewFactory f) {
+            @Override
+            protected void updateDamage(final DocumentEvent changes, final Shape a,
+                    final ViewFactory f) {
                 if (callSuperUpdateDamage) {
                     super.updateDamage(changes, a, f);
                 } else {
@@ -410,8 +399,7 @@
             }
         };
         shape = new Rectangle(500, 500);
-
-        event = ((AbstractDocument)doc).new DefaultDocumentEvent(0, 0,
+        event = ((AbstractDocument) doc).new DefaultDocumentEvent(0, 0,
                 DocumentEvent.EventType.CHANGE);
         factory = new ViewFactory() {
             public View create(final Element element) {
@@ -423,7 +411,6 @@
 
     private void createEvent() {
         doc.addDocumentListener(new DocumentListener() {
-
             public void changedUpdate(final DocumentEvent changes) {
                 fail("changedUpdate isn't supposed to be called");
             }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/PlainView_SimpleTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/PlainView_SimpleTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/PlainView_SimpleTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/PlainView_SimpleTest.java Sun Nov 26 12:15:43 2006
@@ -22,9 +22,7 @@
 
 import java.awt.Container;
 import java.awt.Graphics;
-
 import javax.swing.JTextArea;
-
 import junit.framework.TestCase;
 
 /**
@@ -37,9 +35,13 @@
  */
 public class PlainView_SimpleTest extends TestCase {
     private JTextArea area;
-    private Document  doc;
-    private Element   root;
-    private boolean   updateMetricsCalled;
+
+    private Document doc;
+
+    private Element root;
+
+    private boolean updateMetricsCalled;
+
     private PlainView view;
 
     public void testGetLineBuffer() {
@@ -60,16 +62,16 @@
     public void testPlainView() {
         view = new PlainView(null);
         assertNull(view.getElement());
-
         view = new PlainView(root);
         assertSame(root, view.getElement());
         assertNull(view.metrics); // metrics are lazily initialized
-
         view = new PlainView(root) {
+            @Override
             public Container getContainer() {
                 return area;
             }
 
+            @Override
             public Graphics getGraphics() {
                 return area.getGraphics();
             }
@@ -80,28 +82,30 @@
 
     public void testSetSize() {
         view = new PlainView(root) {
+            @Override
             public Container getContainer() {
                 return new JTextArea();
             }
+
+            @Override
             protected void updateMetrics() {
                 updateMetricsCalled = true;
             }
         };
-
         assertFalse(updateMetricsCalled);
         view.setSize(500, 500);
-        assertTrue("setSize is expected to call updateMetrics",
-                   updateMetricsCalled);
+        assertTrue("setSize is expected to call updateMetrics", updateMetricsCalled);
     }
 
     /**
      * Creates PlainDocument, PlainView on <code>doc</code>'s
      * default root, and rectangular shape.
      */
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
-        doc   = new PlainDocument();
-        root  = doc.getDefaultRootElement();
-        view  = new PlainView(root);
+        doc = new PlainDocument();
+        root = doc.getDefaultRootElement();
+        view = new PlainView(root);
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/PositionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/PositionTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/PositionTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/PositionTest.java Sun Nov 26 12:15:43 2006
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 /**
  * @author Alexey A. Ivanov
  * @version $Revision$
@@ -29,7 +28,6 @@
  *
  */
 public class PositionTest extends TestCase {
-
     public PositionTest() {
         super();
     }
@@ -39,11 +37,10 @@
     }
 
     /*
-    public void testGetOffset() {
-        // Too simple to break
-    }
-    */
-
+     public void testGetOffset() {
+     // Too simple to break
+     }
+     */
     public void testBiasForward() {
         assertEquals("Forward", Position.Bias.Forward.toString());
     }
@@ -51,5 +48,4 @@
     public void testBiasBackward() {
         assertEquals("Backward", Position.Bias.Backward.toString());
     }
-
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/SegmentTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/SegmentTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/SegmentTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/SegmentTest.java Sun Nov 26 12:15:43 2006
@@ -20,20 +20,21 @@
  */
 package javax.swing.text;
 
+import java.text.CharacterIterator;
 import junit.framework.TestCase;
 
 public class SegmentTest extends TestCase {
     private Segment s;
 
-    private char[] arr =
-        new char[] {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k'};
+    private char[] arr = new char[] { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k' };
 
+    @Override
     protected void setUp() {
         s = new Segment(arr, 2, 6);
     }
 
     public void testClone() {
-        Segment clone = (Segment)s.clone();
+        Segment clone = (Segment) s.clone();
         assertEquals(s.array, clone.array);
         assertEquals(s.count, clone.count);
         assertEquals(s.offset, clone.offset);
@@ -53,19 +54,17 @@
         s.setIndex(2);
         assertEquals(s.array[2], s.current());
         s.setIndex(s.getEndIndex());
-        assertEquals(Segment.DONE, s.current());
-
+        assertEquals(CharacterIterator.DONE, s.current());
         s = new Segment();
-        assertEquals(Segment.DONE, s.current());
+        assertEquals(CharacterIterator.DONE, s.current());
     }
 
     public void testFirst() {
         assertEquals(arr[2], s.first());
         assertEquals(s.array[s.getBeginIndex()], s.first());
         assertEquals(s.getBeginIndex(), s.getIndex());
-
         s = new Segment();
-        assertEquals(Segment.DONE, s.first());
+        assertEquals(CharacterIterator.DONE, s.first());
         assertEquals(s.getBeginIndex(), s.getIndex());
     }
 
@@ -73,13 +72,11 @@
         assertEquals(arr[7], s.last());
         assertEquals(s.array[s.getEndIndex() - 1], s.last());
         assertEquals(s.getEndIndex() - 1, s.getIndex());
-
         s = new Segment();
-        assertEquals(Segment.DONE, s.last());
+        assertEquals(CharacterIterator.DONE, s.last());
         assertEquals(s.getEndIndex(), s.getIndex());
-
         s = new Segment(arr, 2, 0);
-        assertEquals(Segment.DONE, s.last());
+        assertEquals(CharacterIterator.DONE, s.last());
         assertEquals(s.getEndIndex(), s.getIndex());
     }
 
@@ -89,34 +86,30 @@
         s.setIndex(4);
         assertEquals(arr[5], s.next());
         s.setIndex(s.getEndIndex());
-        assertEquals(Segment.DONE, s.next());
+        assertEquals(CharacterIterator.DONE, s.next());
         s.setIndex(s.getEndIndex() - 1);
-        assertEquals(Segment.DONE, s.next());
-
+        assertEquals(CharacterIterator.DONE, s.next());
         s = new Segment();
-        assertEquals(Segment.DONE, s.next());
+        assertEquals(CharacterIterator.DONE, s.next());
     }
 
     public void testPrevious() {
         s.setIndex(2);
-        assertEquals(Segment.DONE, s.previous());
+        assertEquals(CharacterIterator.DONE, s.previous());
         s.setIndex(5);
         assertEquals(arr[4], s.previous());
-
         s = new Segment();
-        assertEquals(Segment.DONE, s.previous());
+        assertEquals(CharacterIterator.DONE, s.previous());
     }
 
     public void testGetBeginIndex() {
         assertEquals(2, s.getBeginIndex());
-
         s = new Segment();
         assertEquals(0, s.getBeginIndex());
     }
 
     public void testGetEndIndex() {
         assertEquals(8, s.getEndIndex());
-
         s = new Segment();
         assertEquals(0, s.getEndIndex());
     }
@@ -125,7 +118,6 @@
         assertEquals(0, s.getIndex());
         s.setIndex(5);
         assertEquals(5, s.getIndex());
-
         s = new Segment();
         assertEquals(0, s.getIndex());
     }
@@ -148,21 +140,18 @@
     public void testSetIndex() {
         try {
             s.setIndex(-1);
-
             fail("IllegalArgumentException was expected");
-        } catch (IllegalArgumentException e) { }
+        } catch (IllegalArgumentException e) {
+        }
         assertEquals(0, s.getIndex());
-
         try {
             s.setIndex(s.getEndIndex() + 1);
-
             fail("IllegalArgumentException was expected");
-        } catch (IllegalArgumentException e) { }
+        } catch (IllegalArgumentException e) {
+        }
         assertEquals(0, s.getIndex());
-
-        assertEquals(Segment.DONE, s.setIndex(s.getEndIndex()));
+        assertEquals(CharacterIterator.DONE, s.setIndex(s.getEndIndex()));
         assertEquals(s.getEndIndex(), s.getIndex());
-
         assertEquals(arr[4], s.setIndex(4));
         assertEquals(4, s.getIndex());
     }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/SimpleAttributeSetTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/SimpleAttributeSetTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/SimpleAttributeSetTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/SimpleAttributeSetTest.java Sun Nov 26 12:15:43 2006
@@ -23,7 +23,6 @@
 import javax.swing.BasicSwingTestCase;
 
 public class SimpleAttributeSetTest extends MutableAttributeSetTest {
-
     public SimpleAttributeSetTest() {
         super();
     }
@@ -31,6 +30,7 @@
     public SimpleAttributeSetTest(final String name) {
         super(name);
     }
+
     /**
      * The instance of SimpleAttributeSet.
      */
@@ -39,80 +39,63 @@
     /*
      * @see MutableAttributeSetTest#setUp()
      */
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
-        sas = (SimpleAttributeSet)as;
+        sas = (SimpleAttributeSet) as;
     }
 
     public void testHashCode() {
-        SimpleAttributeSet newSet = (SimpleAttributeSet)sas.clone();
-        assertTrue("Hash codes must be equal for equal objects",
-                   newSet.hashCode() == sas.hashCode());
-
+        SimpleAttributeSet newSet = (SimpleAttributeSet) sas.clone();
+        assertTrue("Hash codes must be equal for equal objects", newSet.hashCode() == sas
+                .hashCode());
         newSet.setResolveParent(SimpleAttributeSet.EMPTY);
         assertFalse("Hash codes should not be equal for not equal objects",
-                    newSet.hashCode() == sas.hashCode());
-
+                newSet.hashCode() == sas.hashCode());
         sas.setResolveParent(new SimpleAttributeSet());
-        assertTrue("Hash codes must be equal for equal objects",
-                   newSet.hashCode() == sas.hashCode());
-
+        assertTrue("Hash codes must be equal for equal objects", newSet.hashCode() == sas
+                .hashCode());
         SimpleAttributeSet parent = new SimpleAttributeSet();
         parent.addAttribute("key", "value");
         newSet.setResolveParent(parent);
         sas.setResolveParent(parent);
-        assertTrue("Hash codes must be equal for equal objects",
-                   newSet.hashCode() == sas.hashCode());
-
+        assertTrue("Hash codes must be equal for equal objects", newSet.hashCode() == sas
+                .hashCode());
         sas.removeAttribute(keys[1]);
         assertFalse("Hash codes should not be equal for not equal objects",
-                    newSet.hashCode() == sas.hashCode());
+                newSet.hashCode() == sas.hashCode());
     }
 
     public void testClone() {
         SimpleAttributeSet parent = new SimpleAttributeSet();
         parent.addAttribute("key", "value");
         sas.setResolveParent(parent);
-
         Object clone = sas.clone();
         assertSame(sas.getClass(), clone.getClass());
         assertNotSame(sas, clone);
         assertEquals(sas, clone);
-        assertEquals(sas.getResolveParent(),
-                     ((SimpleAttributeSet)clone).getResolveParent());
-
+        assertEquals(sas.getResolveParent(), ((SimpleAttributeSet) clone).getResolveParent());
         sas.removeAttribute(keys[1]);
         assertFalse(sas.equals(clone));
     }
 
     public void testEquals() {
-        SimpleAttributeSet newSet = (SimpleAttributeSet)sas.clone();
+        SimpleAttributeSet newSet = (SimpleAttributeSet) sas.clone();
         assertEquals(sas, newSet);
-
         newSet.setResolveParent(SimpleAttributeSet.EMPTY);
         assertFalse(sas.equals(newSet));
-
         sas.setResolveParent(new SimpleAttributeSet());
         assertEquals(sas, newSet);
-
         SimpleAttributeSet parent = new SimpleAttributeSet();
         parent.addAttribute("key", "value");
-
         newSet.setResolveParent(new SimpleAttributeSet(parent));
         sas.setResolveParent(new SimpleAttributeSet(parent));
         assertEquals(sas, newSet);
-
         sas.removeAttribute(keys[1]);
         assertFalse(sas.equals(newSet));
-
-        StyleContext.SmallAttributeSet eq =
-            StyleContext.getDefaultStyleContext().new SmallAttributeSet(
-                new Object[] {
-                        keys[0], values[0],
-                        keys[2], values[2],
-                        AttributeSet.ResolveAttribute, parent
-                });
-
+        StyleContext.SmallAttributeSet eq = StyleContext.getDefaultStyleContext().new SmallAttributeSet(
+                new Object[] { keys[0], values[0], keys[2], values[2],
+                        AttributeSet.ResolveAttribute, parent });
         assertEquals(sas, eq);
     }
 
@@ -130,11 +113,9 @@
 
     public void testIsEmpty() {
         assertFalse(sas.isEmpty());
-        SimpleAttributeSet clone = (SimpleAttributeSet)sas.clone();
-
+        SimpleAttributeSet clone = (SimpleAttributeSet) sas.clone();
         sas.removeAttributes(clone);
         assertTrue(sas.isEmpty());
-
         sas.setResolveParent(clone);
         assertFalse(sas.isEmpty());
     }
@@ -146,9 +127,7 @@
         SimpleAttributeSet parent = new SimpleAttributeSet();
         parent.addAttribute("key", "value");
         sas.setResolveParent(parent);
-
-        SimpleAttributeSet initSet = (SimpleAttributeSet)sas.clone();
-
+        SimpleAttributeSet initSet = (SimpleAttributeSet) sas.clone();
         sas = new SimpleAttributeSet(initSet);
         assertEquals(initSet, sas);
         assertEquals(initSet.getResolveParent(), sas.getResolveParent());
@@ -156,9 +135,8 @@
 
     public void testSerializable() throws Exception {
         sas.setResolveParent(SimpleAttributeSet.EMPTY);
-
-        SimpleAttributeSet readSet =
-            (SimpleAttributeSet)BasicSwingTestCase.serializeObject(sas);
+        SimpleAttributeSet readSet = (SimpleAttributeSet) BasicSwingTestCase
+                .serializeObject(sas);
         assertEquals(sas, readSet);
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StringContentTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StringContentTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StringContentTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StringContentTest.java Sun Nov 26 12:15:43 2006
@@ -24,8 +24,6 @@
 import java.lang.ref.ReferenceQueue;
 import java.lang.ref.WeakReference;
 import java.util.Vector;
-
-import javax.swing.BasicSwingTestCase;
 import javax.swing.undo.UndoableEdit;
 
 /**
@@ -35,22 +33,25 @@
 public class StringContentTest extends AbstractDocument_ContentTest {
     private StringContent content;
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         obj = new StringContent();
         obj.insertString(0, "This is a test string.");
-
         content = new StringContent();
         content.insertString(0, "012345");
     }
 
+    @Override
     public void testGetCharsNegativeLength() {
         if (isHarmony()) {
             testExceptionalCase(new BadLocationCase() {
+                @Override
                 public void exceptionalAction() throws Exception {
                     obj.getChars(0, -2, new Segment());
                 }
 
+                @Override
                 public String expectedExceptionMessage() {
                     return "Length must be non-negative";
                 }
@@ -58,30 +59,36 @@
         } else {
             try {
                 obj.getChars(0, -2, new Segment());
-            } catch (BadLocationException e) { }
+            } catch (BadLocationException e) {
+            }
         }
     }
 
+    @Override
     public void testGetCharsPartial() throws BadLocationException {
         obj.insertString(10, "big ");
-
         text.setPartialReturn(true);
         obj.getChars(8, 10, text);
         assertEquals("a big test", text.toString());
     }
 
+    @Override
     public void testGetStringNegativeLength() {
         if (isHarmony()) {
             testExceptionalCase(new BadLocationCase() {
+                @Override
                 public void exceptionalAction() throws Exception {
                     obj.getString(0, -2);
                 }
+
+                @Override
                 public String expectedExceptionMessage() {
-                        return "Length must be non-negative";
+                    return "Length must be non-negative";
                 }
             });
         } else {
             testExceptionalCase(new StringIndexOutOfBoundsCase() {
+                @Override
                 public void exceptionalAction() throws Exception {
                     obj.getString(0, -2);
                 }
@@ -92,29 +99,22 @@
     public void testStringContent() throws BadLocationException {
         content = new StringContent();
         assertEquals(1, content.length());
-
         content.getChars(0, content.length(), text);
         assertEquals("\n", text.toString());
         assertEquals(10, text.array.length);
     }
 
-    public void testStringContent_WithValidValues()
-        throws BadLocationException {
-
+    public void testStringContent_WithValidValues() throws BadLocationException {
         content = new StringContent(20);
         assertEquals(1, content.length());
-
         content.getChars(0, content.length(), text);
         assertEquals("\n", text.toString());
         assertEquals(20, text.array.length);
     }
 
-    public void testStringContent_WithInvalidValues()
-        throws BadLocationException {
-
+    public void testStringContent_WithInvalidValues() throws BadLocationException {
         content = new StringContent(0);
         assertEquals(1, content.length());
-
         content.getChars(0, content.length(), text);
         assertEquals("\n", text.toString());
         assertEquals(1, text.array.length);
@@ -122,81 +122,61 @@
 
     public void testCreatePositionBeforeUndo() throws BadLocationException {
         UndoableEdit undoable;
-
         content = new StringContent(10);
         content.insertString(0, "0123456789");
-
-        undoable  = content.remove(3, 5);
-        Position     pos1 = content.createPosition(3);
-
+        undoable = content.remove(3, 5);
+        Position pos1 = content.createPosition(3);
         assertEquals(3, pos1.getOffset());
         undoable.undo();
-
         content = new StringContent(10);
         content.insertString(0, "0123456789");
-
-        undoable  = content.remove(3, 5);
-        Position     pos = content.createPosition(3);
-
+        undoable = content.remove(3, 5);
+        Position pos = content.createPosition(3);
         assertEquals(3, pos.getOffset());
-
         undoable.undo();
         assertEquals(8, pos.getOffset());
-
         undoable.redo();
         assertEquals(3, pos.getOffset());
     }
 
     public void testCreatePositionAfterUndone() throws BadLocationException {
         UndoableEdit undoable;
-
         content = new StringContent(10);
         content.insertString(0, "0123456789");
-
-        undoable  = content.remove(3, 5);
+        undoable = content.remove(3, 5);
         undoable.undo();
-
         Position pos = content.createPosition(5);
         assertEquals(5, pos.getOffset());
-
         undoable.redo();
         assertEquals(3, pos.getOffset());
-
         undoable.undo();
         assertEquals(5, pos.getOffset());
     }
 
     public void testCreatePositionAfterInsert() throws BadLocationException {
         UndoableEdit undoable;
-
         content = new StringContent(10);
         content.insertString(0, "0123456789");
-
-        undoable  = content.insertString(10, "big ");
-        Position     pos = content.createPosition(12);
-
+        undoable = content.insertString(10, "big ");
+        Position pos = content.createPosition(12);
         assertEquals(12, pos.getOffset());
-
         undoable.undo();
         assertEquals(10, pos.getOffset());
-
         undoable.redo();
         assertEquals(12, pos.getOffset());
     }
 
-
-    public void testCreatePosition_WithInvalidValues()
-        throws BadLocationException {
-
+    public void testCreatePosition_WithInvalidValues() throws BadLocationException {
         content = new StringContent(10);
         content.insertString(0, "012345");
-
         if (isHarmony()) {
             testExceptionalCase(new BadLocationCase() {
+                @Override
                 public void exceptionalAction() throws Exception {
                     content.createPosition(-1);
                 }
 
+                @Override
                 public String expectedExceptionMessage() {
                     return "Invalid position offset";
                 }
@@ -204,7 +184,6 @@
         } else {
             content.createPosition(-1);
         }
-
         content.createPosition(12);
     }
 
@@ -212,7 +191,6 @@
         content = new StringContent();
         content.getChars(0, 1, text);
         content.getChars(0, 0, text);
-
         content.getChars(0, content.length(), text);
         assertEquals("\n", text.toString());
         assertEquals(10, text.array.length);
@@ -222,10 +200,12 @@
         content = new StringContent();
         if (isHarmony()) {
             testExceptionalCase(new BadLocationCase() {
+                @Override
                 public void exceptionalAction() throws Exception {
                     content.getChars(-5, 1, text);
                 }
 
+                @Override
                 public String expectedExceptionMessage() {
                     return "Invalid start position";
                 }
@@ -233,19 +213,20 @@
         } else {
             content.getChars(-5, 1, text);
         }
-
         testExceptionalCase(new BadLocationCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 content.getChars(0, 2, text);
             }
         });
-
         if (isHarmony()) {
             testExceptionalCase(new BadLocationCase() {
+                @Override
                 public void exceptionalAction() throws Exception {
                     content.getChars(0, -2, text);
                 }
 
+                @Override
                 public String expectedExceptionMessage() {
                     return "Length must be non-negative";
                 }
@@ -256,13 +237,12 @@
     }
 
     public void testGetPositionsInRangeVector() throws BadLocationException {
-        Vector v = new Vector();
+        Vector<Object> v = new Vector<Object>();
         v.add(new Object());
         v.add(new Object());
         content.createPosition(0);
         content.createPosition(1);
         content.createPosition(2);
-
         content.getPositionsInRange(v, 0, 3);
         if (isHarmony()) {
             // Position at offset 0 WILL NOT be included
@@ -275,7 +255,7 @@
 
     public void testGetPositionsInRange() throws BadLocationException {
         content.createPosition(10);
-        Vector v = content.getPositionsInRange(null, 0, 10);
+        Vector<?> v = content.getPositionsInRange(null, 0, 10);
         assertEquals(1, v.size());
     }
 
@@ -286,39 +266,42 @@
 
     public void testGetString_WithInValidValues() throws BadLocationException {
         testExceptionalCase(new BadLocationCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 content.getString(0, content.length() + 1);
             }
         });
-
         testExceptionalCase(new BadLocationCase() {
-                public void exceptionalAction() throws Exception {
-                    content.getString(0, content.length() + 5);
-                }
+            @Override
+            public void exceptionalAction() throws Exception {
+                content.getString(0, content.length() + 5);
+            }
         });
-
         if (isHarmony()) {
             testExceptionalCase(new BadLocationCase() {
-            public void exceptionalAction() throws Exception {
+                @Override
+                public void exceptionalAction() throws Exception {
                     content.getString(-1, content.length() - 2);
                 }
             });
         } else {
             testExceptionalCase(new StringIndexOutOfBoundsCase() {
+                @Override
                 public void exceptionalAction() throws Exception {
                     content.getString(-1, content.length() - 2);
                 }
             });
         }
-
         if (isHarmony()) {
             testExceptionalCase(new BadLocationCase() {
-            public void exceptionalAction() throws Exception {
-                content.getString(1, -1);
+                @Override
+                public void exceptionalAction() throws Exception {
+                    content.getString(1, -1);
                 }
             });
         } else {
             testExceptionalCase(new StringIndexOutOfBoundsCase() {
+                @Override
                 public void exceptionalAction() throws Exception {
                     content.getString(1, -1);
                 }
@@ -329,63 +312,53 @@
     public void testInsertString_WithValidValues() throws BadLocationException {
         UndoableEdit ue = content.insertString(2, "^^^");
         assertNotNull(ue);
-
         content.getChars(0, content.length(), text);
         assertEquals(20, text.array.length);
-
         assertEquals("01^^^2345\n", content.getString(0, content.length()));
-
         ue.undo();
         assertEquals("012345\n", content.getString(0, content.length()));
-
         ue.redo();
         assertEquals("01^^^2345\n", content.getString(0, content.length()));
     }
 
-    public void testInsertString_WithInvalidValues()
-        throws BadLocationException {
-
+    public void testInsertString_WithInvalidValues() throws BadLocationException {
         content = new StringContent();
-
         testExceptionalCase(new BadLocationCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 content.insertString(-1, "12345");
             }
         });
-
         testExceptionalCase(new BadLocationCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 content.insertString(1, "12345");
             }
         });
         testExceptionalCase(new NullPointerCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 content.insertString(0, null);
             }
         });
-
     }
 
     public void testInsertString_UndoableEdit() throws BadLocationException {
         UndoableEdit undoable;
         final String redoName = isHarmony() ? "Redo addition" : "Redo";
         final String undoName = isHarmony() ? "Undo addition" : "Undo";
-
-        undoable =  content.insertString(0, "012345");
+        undoable = content.insertString(0, "012345");
         assertEquals(redoName, undoable.getRedoPresentationName());
         assertEquals(undoName, undoable.getUndoPresentationName());
         assertTrue(undoable.isSignificant());
         assertFalse(undoable.canRedo());
         assertTrue(undoable.canUndo());
-
         undoable.undo();
         assertTrue(undoable.canRedo());
         assertFalse(undoable.canUndo());
-
         undoable.redo();
         assertFalse(undoable.canRedo());
         assertTrue(undoable.canUndo());
-
         assertFalse(undoable.addEdit(null));
         assertFalse(undoable.addEdit(undoable));
     }
@@ -396,26 +369,20 @@
         content.getChars(0, content.length(), text);
         assertEquals(13, text.count);
         assertEquals(20, text.array.length);
-
         UndoableEdit undoable = content.remove(2, 0);
         content.getChars(0, content.length(), text);
         assertEquals(13, text.count);
         assertEquals(20, text.array.length);
-
         assertNotNull(undoable);
         assertEquals("012345^11111\n", content.getString(0, content.length()));
-
         undoable = content.remove(2, 5);
         content.getChars(0, content.length(), text);
         assertEquals(8, text.count);
         assertEquals(20, text.array.length);
-
         assertNotNull(undoable);
         assertEquals("0111111\n", content.getString(0, content.length()));
-
         undoable.undo();
         assertEquals("012345^11111\n", content.getString(0, content.length()));
-
         undoable.redo();
         assertEquals("0111111\n", content.getString(0, content.length()));
     }
@@ -424,27 +391,22 @@
         UndoableEdit undoable = content.remove(2, 3);
         final String redoName = isHarmony() ? "Redo deletion" : "Redo";
         final String undoName = isHarmony() ? "Undo deletion" : "Undo";
-
         assertEquals(redoName, undoable.getRedoPresentationName());
         assertEquals(undoName, undoable.getUndoPresentationName());
         assertTrue(undoable.isSignificant());
         assertFalse(undoable.canRedo());
         assertTrue(undoable.canUndo());
-
         assertEquals(redoName, undoable.getRedoPresentationName());
         assertEquals(undoName, undoable.getUndoPresentationName());
         assertTrue(undoable.isSignificant());
         assertFalse(undoable.canRedo());
         assertTrue(undoable.canUndo());
-
         undoable.undo();
         assertTrue(undoable.canRedo());
         assertFalse(undoable.canUndo());
-
         undoable.redo();
         assertFalse(undoable.canRedo());
         assertTrue(undoable.canUndo());
-
         assertFalse(undoable.addEdit(null));
         assertFalse(undoable.addEdit(undoable));
     }
@@ -455,35 +417,29 @@
         content.getChars(0, content.length(), text);
         assertEquals(13, text.count);
         assertEquals(20, text.array.length);
-
         UndoableEdit ue = content.remove(2, 5);
         content.getChars(0, content.length(), text);
         assertEquals(8, text.count);
         assertEquals(20, text.array.length);
-
         assertNotNull(ue);
         assertEquals("0111111\n", content.getString(0, content.length()));
-
         ue.undo();
         assertEquals("012345^11111\n", content.getString(0, content.length()));
-
         ue.redo();
         assertEquals("0111111\n", content.getString(0, content.length()));
     }
 
     public void testPositionGC() throws BadLocationException {
-        Vector pos = new Vector(10);
-        ReferenceQueue rq = new ReferenceQueue();
+        Vector<WeakReference<Position>> pos = new Vector<WeakReference<Position>>(10);
+        ReferenceQueue<Position> rq = new ReferenceQueue<Position>();
         for (int i = 0; i < content.length(); i += 2) {
-            pos.add(new WeakReference(content.createPosition(i), rq));
+            pos.add(new WeakReference<Position>(content.createPosition(i), rq));
         }
-
         int count = 0;
         int i;
         for (i = 0; i < 100; i++) {
             System.gc();
-
-            Reference r;
+            Reference<?> r;
             if ((r = rq.poll()) != null) {
                 pos.remove(r);
                 count++;
@@ -492,75 +448,55 @@
                 }
             }
         }
-
-        fail("Not all Position objects are removed ("
-             + pos.size() + "/" + count + ").");
+        fail("Not all Position objects are removed (" + pos.size() + "/" + count + ").");
     }
 
     public void testLength_ForStringContent() throws Exception {
         content = new StringContent();
         assertEquals(1, content.length());
-
         content.insertString(0, " Hello word ");
         assertEquals(13, content.length());
-
         content.insertString(0, " Hello word ");
         assertEquals(25, content.length());
-
         content.remove(0, 0);
         assertEquals(25, content.length());
-
         content.remove(0, 2);
         assertEquals(23, content.length());
-
         content.remove(1, 3);
         assertEquals(20, content.length());
-
         content.remove(content.length() - 2, 1);
         assertEquals(19, content.length());
-
         content = new StringContent(20);
         assertEquals(1, content.length());
-
         content.insertString(0, " Hello word ");
         assertEquals(13, content.length());
-
         content.insertString(0, " Hello word ");
         assertEquals(25, content.length());
-
         content.remove(0, 0);
         assertEquals(25, content.length());
-
         content.remove(0, 2);
         assertEquals(23, content.length());
-
         content.remove(1, 3);
         assertEquals(20, content.length());
-
         content.remove(content.length() - 2, 1);
         assertEquals(19, content.length());
-
     }
 
     public void testInnerContentSize() throws BadLocationException {
-
         content = new StringContent(30);
         insertStringManyTimes("a", 160, content);
         content.getChars(0, content.length(), text);
         assertEquals(160, text.count);
         assertEquals(30 * 8, text.array.length);
-
         content = new StringContent();
         insertStringManyTimes("a", 159, content);
         content.getChars(0, content.length(), text);
         assertEquals(159, text.count);
         assertEquals(10 * 16, text.array.length);
-
         content.insertString(0, "i");
         content.getChars(0, content.length(), text);
         assertEquals(160, text.count);
         assertEquals(10 * 16 * 2, text.array.length);
-
         // If after insert operation new content length
         // exceeds current content size, content size
         // will increaze:
@@ -573,51 +509,42 @@
         } else {
             assertEquals(100, text.array.length);
         }
-
         insertStringManyTimes("a", 11, content);
         content.getChars(0, content.length(), text);
         assertEquals(110, text.count);
         assertEquals(200, text.array.length);
-
         // Rule1
         //
         // If after insert operation new content length
         // doesn't exceed content size, then content size
         // wont be enlarged.
         content = new StringContent(101);
-
         content.insertString(0, createString(99));
         content.getChars(0, content.length(), text);
         assertEquals(99, text.count);
         assertEquals(101, text.array.length);
-
         content.insertString(0, "i");
         content.getChars(0, content.length(), text);
         assertEquals(100, text.count);
         assertEquals(101, text.array.length);
-
         // This test shows that Rule1 is "initial length free"
         content = new StringContent(101);
         content.insertString(0, createString(100));
         content.getChars(0, content.length(), text);
         assertEquals(100, text.count);
         assertEquals(101, text.array.length);
-
         content.insertString(0, "i");
         content.getChars(0, content.length(), text);
         assertEquals(101, text.count);
         assertEquals(202, text.array.length);
-
         content.insertString(0, createString(103));
         content.getChars(0, content.length(), text);
         assertEquals(203, text.count);
         assertEquals(404, text.array.length);
-
         content.insertString(0, createString(301));
         content.getChars(0, content.length(), text);
         assertEquals(503, text.count);
         assertEquals(808, text.array.length);
-
         // Rule2
         //
         // If after insert operation new content length
@@ -633,7 +560,6 @@
             // content size will be changed to new content length
             assertEquals(503, text.array.length);
         }
-
         //Rule3
         //
         //If after insert operation new content length
@@ -646,15 +572,12 @@
         assertEquals(504, text.array.length);
     }
 
-    private void insertStringManyTimes(String str, int ntimes,
-                                       StringContent content)
-        throws BadLocationException {
-
+    private void insertStringManyTimes(String str, int ntimes, StringContent content)
+            throws BadLocationException {
         for (int i = 1; i < ntimes; i++) {
             content.insertString(0, str);
         }
     }
-
 
     private String createString(final int size) {
         StringBuffer result = new StringBuffer();

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StringContentTest_CommonTests.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StringContentTest_CommonTests.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StringContentTest_CommonTests.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StringContentTest_CommonTests.java Sun Nov 26 12:15:43 2006
@@ -21,42 +21,38 @@
 package javax.swing.text;
 
 import java.util.Vector;
-
 import javax.swing.BasicSwingTestCase;
 import javax.swing.undo.UndoableEdit;
 
-
 public class StringContentTest_CommonTests extends GapContentTest {
-
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         obj = content = new StringContent(30);
         obj.insertString(0, "This is a test string.");
     }
 
+    @Override
     public void testGetCharsImpliedCharPartial() throws BadLocationException {
         obj = content = new StringContent();
-
         assertEquals(1, content.length());
-
         text.setPartialReturn(false);
         content.getChars(0, 1, text);
         assertEquals("\n", text.toString());
-
         text.setPartialReturn(true);
         content.getChars(0, 1, text);
         assertEquals("\n", text.toString());
     }
 
+    @Override
     public void testGetPositionsInRangeVector() throws BadLocationException {
-        Vector v = new Vector();
+        Vector<Object> v = new Vector<Object>();
         v.add(new Object());
         v.add(new Object());
         content.createPosition(0);
         content.createPosition(1);
         content.createPosition(2);
-
-        ((StringContent)content).getPositionsInRange(v, 0, 3);
+        ((StringContent) content).getPositionsInRange(v, 0, 3);
         if (BasicSwingTestCase.isHarmony()) {
             // Position at offset 0 WILL NOT be included
             assertEquals(4, v.size());
@@ -70,74 +66,82 @@
      * Tests that the position at offset of offset + len is included in
      * the returned vector.
      */
+    @Override
     public void testGetPositionsInRangeEnd() throws BadLocationException {
         content.createPosition(10);
-        Vector v = ((StringContent)content).getPositionsInRange(null, 0, 10);
+        Vector<?> v = ((StringContent) content).getPositionsInRange(null, 0, 10);
         assertEquals(1, v.size());
     }
 
+    @Override
     public void testGetPositionsInRange() throws BadLocationException {
-        Vector pos = new Vector();
-
+        Vector<Position> pos = new Vector<Position>();
         for (int i = 0; i < content.length(); i += 2) {
             Position p = content.createPosition(i);
             if (i >= 3 && i <= 3 + 9) {
                 pos.add(p);
             }
         }
-        Vector v = ((StringContent)content).getPositionsInRange(null, 3, 9);
-
+        Vector<?> v = ((StringContent) content).getPositionsInRange(null, 3, 9);
         assertEquals(pos.size(), v.size());
-
         int[] offsets = new int[v.size()];
         for (int i = 0; i < pos.size(); i++) {
-            offsets[i] = ((Position)pos.get(i)).getOffset();
+            offsets[i] = pos.get(i).getOffset();
         }
-
         UndoableEdit ue = content.remove(0, 9);
         ue.undo();
-
         for (int i = 0; i < pos.size(); i++) {
-            assertEquals(offsets[i], ((Position)pos.get(i)).getOffset());
+            assertEquals(offsets[i], pos.get(i).getOffset());
         }
     }
 
+    @Override
     public void testGetCharsNegativeLength() {
         // Is Already tested in StringContentTest
     }
 
+    @Override
     public void testGetCharsAfterGapNoImplied() throws BadLocationException {
         // N/A
     }
 
+    @Override
     public void testGetCharsAfterGap() throws BadLocationException {
         // N/A
     }
 
+    @Override
     public void testGetCharsBeforeGap() throws BadLocationException {
         // N/A
     }
 
+    @Override
     public void testGetCharsFullLength() throws BadLocationException {
         // N/A
     }
 
+    @Override
     public void testGetCharsFullActualLength() throws BadLocationException {
         // N/A
     }
 
+    @Override
     public void testGetCharsImpliedChar() throws BadLocationException {
         // N/A
     }
+
+    @Override
     public void testGetCharsPartial() throws BadLocationException {
         // N/A
     }
 
+    @Override
     public void testGetCharsWithGap() throws BadLocationException {
         // N/A
     }
 
+    @Override
     public void testGetStringNegativeLength() {
-      // Is Already tested in StringContentTest
+        // Is Already tested in StringContentTest
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StringContent_ComplexUndoTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StringContent_ComplexUndoTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StringContent_ComplexUndoTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StringContent_ComplexUndoTest.java Sun Nov 26 12:15:43 2006
@@ -21,6 +21,7 @@
 package javax.swing.text;
 
 public class StringContent_ComplexUndoTest extends GapContent_ComplexUndoTest {
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         content = new StringContent();

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StringContent_UndoTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StringContent_UndoTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StringContent_UndoTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StringContent_UndoTest.java Sun Nov 26 12:15:43 2006
@@ -20,15 +20,15 @@
  */
 package javax.swing.text;
 
-
 public class StringContent_UndoTest extends GapContent_UndoTest {
-
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         content = new StringContent();
         insertEdit = content.insertString(0, "01234");
     }
 
+    @Override
     public void testDieText() {
         // N/A
     }



Mime
View raw message