harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r479418 [36/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/StyleConstantsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleConstantsTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleConstantsTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleConstantsTest.java Sun Nov 26 12:15:43 2006
@@ -24,19 +24,17 @@
 import java.awt.Color;
 import java.awt.Component;
 import java.awt.Graphics;
-
 import javax.swing.Icon;
-
 import javax.swing.JLabel;
 
 public class StyleConstantsTest extends TestCase {
-
     protected StyleConstants sc;
 
     protected SimpleAttributeSet attr = new SimpleAttributeSet();
 
     String message = "Test for StyleConstants";
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         sc = new StyleConstants(message);
@@ -52,102 +50,78 @@
     }
 
     public void testFirstLineIndent() {
-        assertEquals(
-            StyleConstants.ParagraphConstants.class,
-            StyleConstants.FirstLineIndent.getClass());
-        assertEquals(
-            "FirstLineIndent",
-            StyleConstants.FirstLineIndent.toString());
+        assertEquals(StyleConstants.ParagraphConstants.class, StyleConstants.FirstLineIndent
+                .getClass());
+        assertEquals("FirstLineIndent", StyleConstants.FirstLineIndent.toString());
     }
 
     public void testGetFirstLineIndent() {
-        assertTrue(0.0f == StyleConstants.getFirstLineIndent(
-                               SimpleAttributeSet.EMPTY));
+        assertTrue(0.0f == StyleConstants.getFirstLineIndent(SimpleAttributeSet.EMPTY));
         float value = 1.23f;
         putAttribute(StyleConstants.FirstLineIndent, new Float(value));
         assertTrue(value == StyleConstants.getFirstLineIndent(attr));
     }
 
     public void testLeftIndent() {
-        assertEquals(
-            StyleConstants.ParagraphConstants.class,
-            StyleConstants.LeftIndent.getClass());
-        assertEquals(
-            "LeftIndent",
-            StyleConstants.LeftIndent.toString());
+        assertEquals(StyleConstants.ParagraphConstants.class, StyleConstants.LeftIndent
+                .getClass());
+        assertEquals("LeftIndent", StyleConstants.LeftIndent.toString());
     }
 
     public void testGetLeftIndent() {
-        assertTrue(
-            0.0f == StyleConstants.getLeftIndent(SimpleAttributeSet.EMPTY));
+        assertTrue(0.0f == StyleConstants.getLeftIndent(SimpleAttributeSet.EMPTY));
         float value = 1.234f;
         putAttribute(StyleConstants.LeftIndent, new Float(value));
         assertTrue(value == StyleConstants.getLeftIndent(attr));
     }
 
     public void testLineSpacing() {
-        assertEquals(
-            StyleConstants.ParagraphConstants.class,
-            StyleConstants.LineSpacing.getClass());
-        assertEquals(
-            "LineSpacing",
-            StyleConstants.LineSpacing.toString());
+        assertEquals(StyleConstants.ParagraphConstants.class, StyleConstants.LineSpacing
+                .getClass());
+        assertEquals("LineSpacing", StyleConstants.LineSpacing.toString());
     }
 
     public void testGetLineSpacing() {
-        assertTrue(
-            0.0f == StyleConstants.getLineSpacing(SimpleAttributeSet.EMPTY));
+        assertTrue(0.0f == StyleConstants.getLineSpacing(SimpleAttributeSet.EMPTY));
         float value = 1.2345f;
         putAttribute(StyleConstants.LineSpacing, new Float(value));
         assertTrue(value == StyleConstants.getLineSpacing(attr));
     }
 
     public void testRightIndent() {
-        assertEquals(
-            StyleConstants.ParagraphConstants.class,
-            StyleConstants.RightIndent.getClass());
-        assertEquals(
-            "RightIndent",
-            StyleConstants.RightIndent.toString());
+        assertEquals(StyleConstants.ParagraphConstants.class, StyleConstants.RightIndent
+                .getClass());
+        assertEquals("RightIndent", StyleConstants.RightIndent.toString());
     }
 
     public void testGetRightIndent() {
-        assertTrue(
-            0.0f == StyleConstants.getRightIndent(SimpleAttributeSet.EMPTY));
+        assertTrue(0.0f == StyleConstants.getRightIndent(SimpleAttributeSet.EMPTY));
         float value = 1.23456f;
         putAttribute(StyleConstants.RightIndent, new Float(value));
         assertTrue(value == StyleConstants.getRightIndent(attr));
     }
 
     public void testSpaceAbove() {
-        assertEquals(
-            StyleConstants.ParagraphConstants.class,
-            StyleConstants.SpaceAbove.getClass());
-        assertEquals(
-            "SpaceAbove",
-            StyleConstants.SpaceAbove.toString());
+        assertEquals(StyleConstants.ParagraphConstants.class, StyleConstants.SpaceAbove
+                .getClass());
+        assertEquals("SpaceAbove", StyleConstants.SpaceAbove.toString());
     }
 
     public void testGetSpaceAbove() {
-        assertTrue(
-            0.0f == StyleConstants.getSpaceAbove(SimpleAttributeSet.EMPTY));
+        assertTrue(0.0f == StyleConstants.getSpaceAbove(SimpleAttributeSet.EMPTY));
         float value = 1.234567f;
         putAttribute(StyleConstants.SpaceAbove, new Float(value));
         assertTrue(value == StyleConstants.getSpaceAbove(attr));
     }
 
     public void testSpaceBelow() {
-        assertEquals(
-            StyleConstants.ParagraphConstants.class,
-            StyleConstants.SpaceBelow.getClass());
-        assertEquals(
-            "SpaceBelow",
-            StyleConstants.SpaceBelow.toString());
+        assertEquals(StyleConstants.ParagraphConstants.class, StyleConstants.SpaceBelow
+                .getClass());
+        assertEquals("SpaceBelow", StyleConstants.SpaceBelow.toString());
     }
 
     public void testGetSpaceBelow() {
-        assertTrue(
-            0.0f == StyleConstants.getSpaceBelow(SimpleAttributeSet.EMPTY));
+        assertTrue(0.0f == StyleConstants.getSpaceBelow(SimpleAttributeSet.EMPTY));
         float value = 1.2345678f;
         putAttribute(StyleConstants.SpaceBelow, new Float(value));
         assertTrue(value == StyleConstants.getSpaceBelow(attr));
@@ -178,31 +152,22 @@
     }
 
     public void testAlignment() {
-        assertEquals(
-            StyleConstants.ParagraphConstants.class,
-            StyleConstants.Alignment.getClass());
-        assertEquals(
-            "Alignment",
-            StyleConstants.Alignment.toString());
+        assertEquals(StyleConstants.ParagraphConstants.class, StyleConstants.Alignment
+                .getClass());
+        assertEquals("Alignment", StyleConstants.Alignment.toString());
     }
 
     public void testGetAlignment() {
-        assertTrue(StyleConstants.ALIGN_LEFT
-                   == StyleConstants.getAlignment(SimpleAttributeSet.EMPTY));
-        putAttribute(
-            StyleConstants.Alignment,
-            new Integer(StyleConstants.ALIGN_JUSTIFIED));
-        assertTrue(StyleConstants.ALIGN_JUSTIFIED
-                   == StyleConstants.getAlignment(attr));
+        assertTrue(StyleConstants.ALIGN_LEFT == StyleConstants
+                .getAlignment(SimpleAttributeSet.EMPTY));
+        putAttribute(StyleConstants.Alignment, new Integer(StyleConstants.ALIGN_JUSTIFIED));
+        assertTrue(StyleConstants.ALIGN_JUSTIFIED == StyleConstants.getAlignment(attr));
     }
 
     public void testBidiLevel() {
-        assertEquals(
-            StyleConstants.CharacterConstants.class,
-            StyleConstants.BidiLevel.getClass());
-        assertEquals(
-            "bidiLevel",
-            StyleConstants.BidiLevel.toString());
+        assertEquals(StyleConstants.CharacterConstants.class, StyleConstants.BidiLevel
+                .getClass());
+        assertEquals("bidiLevel", StyleConstants.BidiLevel.toString());
     }
 
     public void testGetBidiLevel() {
@@ -213,12 +178,8 @@
     }
 
     public void testFontSize() {
-        assertEquals(
-            StyleConstants.FontConstants.class,
-            StyleConstants.FontSize.getClass());
-        assertEquals(
-            "size",
-            StyleConstants.FontSize.toString());
+        assertEquals(StyleConstants.FontConstants.class, StyleConstants.FontSize.getClass());
+        assertEquals("size", StyleConstants.FontSize.toString());
     }
 
     public void testGetFontSize() {
@@ -229,12 +190,8 @@
     }
 
     public void testBold() {
-        assertEquals(
-            StyleConstants.FontConstants.class,
-            StyleConstants.Bold.getClass());
-        assertEquals(
-            "bold",
-            StyleConstants.Bold.toString());
+        assertEquals(StyleConstants.FontConstants.class, StyleConstants.Bold.getClass());
+        assertEquals("bold", StyleConstants.Bold.toString());
     }
 
     public void testIsBold() {
@@ -246,12 +203,8 @@
     }
 
     public void testItalic() {
-        assertEquals(
-            StyleConstants.FontConstants.class,
-            StyleConstants.Italic.getClass());
-        assertEquals(
-            "italic",
-            StyleConstants.Italic.toString());
+        assertEquals(StyleConstants.FontConstants.class, StyleConstants.Italic.getClass());
+        assertEquals("italic", StyleConstants.Italic.toString());
     }
 
     public void testIsItalic() {
@@ -263,12 +216,9 @@
     }
 
     public void testStrikeThrough() {
-        assertEquals(
-            StyleConstants.CharacterConstants.class,
-            StyleConstants.StrikeThrough.getClass());
-        assertEquals(
-            "strikethrough",
-            StyleConstants.StrikeThrough.toString());
+        assertEquals(StyleConstants.CharacterConstants.class, StyleConstants.StrikeThrough
+                .getClass());
+        assertEquals("strikethrough", StyleConstants.StrikeThrough.toString());
     }
 
     public void testIsStrikeThrough() {
@@ -280,12 +230,9 @@
     }
 
     public void testSubscript() {
-        assertEquals(
-            StyleConstants.CharacterConstants.class,
-            StyleConstants.Subscript.getClass());
-        assertEquals(
-            "subscript",
-            StyleConstants.Subscript.toString());
+        assertEquals(StyleConstants.CharacterConstants.class, StyleConstants.Subscript
+                .getClass());
+        assertEquals("subscript", StyleConstants.Subscript.toString());
     }
 
     public void testIsSubscript() {
@@ -297,12 +244,9 @@
     }
 
     public void testSuperscript() {
-        assertEquals(
-            StyleConstants.CharacterConstants.class,
-            StyleConstants.Superscript.getClass());
-        assertEquals(
-            "superscript",
-            StyleConstants.Superscript.toString());
+        assertEquals(StyleConstants.CharacterConstants.class, StyleConstants.Superscript
+                .getClass());
+        assertEquals("superscript", StyleConstants.Superscript.toString());
     }
 
     public void testIsSuperscript() {
@@ -314,12 +258,9 @@
     }
 
     public void testUnderline() {
-        assertEquals(
-            StyleConstants.CharacterConstants.class,
-            StyleConstants.Underline.getClass());
-        assertEquals(
-            "underline",
-            StyleConstants.Underline.toString());
+        assertEquals(StyleConstants.CharacterConstants.class, StyleConstants.Underline
+                .getClass());
+        assertEquals("underline", StyleConstants.Underline.toString());
     }
 
     public void testIsUnderline() {
@@ -334,173 +275,133 @@
         attr.removeAttributes(attr);
         float val = 1.2f;
         StyleConstants.setFirstLineIndent(attr, val);
-        assertTrue(
-            val == ((Float)attr.getAttribute(
-                       StyleConstants.FirstLineIndent)).floatValue());
+        assertTrue(val == ((Float) attr.getAttribute(StyleConstants.FirstLineIndent))
+                .floatValue());
     }
 
     public void testSetLeftIndent() {
         attr.removeAttributes(attr);
         float val = 1.23f;
         StyleConstants.setLeftIndent(attr, val);
-        assertTrue(
-            val == ((Float)attr.getAttribute(
-                       StyleConstants.LeftIndent)).floatValue());
+        assertTrue(val == ((Float) attr.getAttribute(StyleConstants.LeftIndent)).floatValue());
     }
 
     public void testSetLineSpacing() {
         attr.removeAttributes(attr);
         float val = 1.234f;
         StyleConstants.setLineSpacing(attr, val);
-        assertTrue(
-            val == ((Float)attr.getAttribute(
-                       StyleConstants.LineSpacing)).floatValue());
+        assertTrue(val == ((Float) attr.getAttribute(StyleConstants.LineSpacing)).floatValue());
     }
 
     public void testSetRightIndent() {
         attr.removeAttributes(attr);
         float val = 1.2345f;
         StyleConstants.setRightIndent(attr, val);
-        assertTrue(
-            val == ((Float)attr.getAttribute(
-                       StyleConstants.RightIndent)).floatValue());
+        assertTrue(val == ((Float) attr.getAttribute(StyleConstants.RightIndent)).floatValue());
     }
 
     public void testSetSpaceAbove() {
         attr.removeAttributes(attr);
         float val = 1.23456f;
         StyleConstants.setSpaceAbove(attr, val);
-        assertTrue(
-            val == ((Float)attr.getAttribute(
-                       StyleConstants.SpaceAbove)).floatValue());
+        assertTrue(val == ((Float) attr.getAttribute(StyleConstants.SpaceAbove)).floatValue());
     }
 
     public void testSetSpaceBelow() {
         attr.removeAttributes(attr);
         float val = 1.234567f;
         StyleConstants.setSpaceBelow(attr, val);
-        assertTrue(
-            val == ((Float)attr.getAttribute(
-                        StyleConstants.SpaceBelow)).floatValue());
+        assertTrue(val == ((Float) attr.getAttribute(StyleConstants.SpaceBelow)).floatValue());
     }
 
     public void testSetAlignment() {
         attr.removeAttributes(attr);
         StyleConstants.setAlignment(attr, StyleConstants.ALIGN_JUSTIFIED);
-        assertTrue(StyleConstants.ALIGN_JUSTIFIED
-                   == ((Integer)attr.getAttribute(StyleConstants.Alignment))
-                      .intValue());
+        assertTrue(StyleConstants.ALIGN_JUSTIFIED == ((Integer) attr
+                .getAttribute(StyleConstants.Alignment)).intValue());
     }
 
     public void testSetBidiLevel() {
         attr.removeAttributes(attr);
         int val = 2;
         StyleConstants.setBidiLevel(attr, val);
-        assertTrue(
-            val == ((Integer)attr.getAttribute(
-                       StyleConstants.BidiLevel)).intValue());
+        assertTrue(val == ((Integer) attr.getAttribute(StyleConstants.BidiLevel)).intValue());
     }
 
     public void testSetFontSize() {
         attr.removeAttributes(attr);
         int val = 10;
         StyleConstants.setFontSize(attr, val);
-        assertTrue(
-            val == ((Integer)attr.getAttribute(
-                       StyleConstants.FontSize)).intValue());
+        assertTrue(val == ((Integer) attr.getAttribute(StyleConstants.FontSize)).intValue());
     }
 
     public void testSetBold() {
         attr.removeAttributes(attr);
         StyleConstants.setBold(attr, true);
-        assertTrue(((Boolean)attr.getAttribute(
-                        StyleConstants.Bold)).booleanValue());
+        assertTrue(((Boolean) attr.getAttribute(StyleConstants.Bold)).booleanValue());
         StyleConstants.setBold(attr, false);
-        assertFalse(((Boolean)attr.getAttribute(
-                         StyleConstants.Bold)).booleanValue());
+        assertFalse(((Boolean) attr.getAttribute(StyleConstants.Bold)).booleanValue());
     }
 
     public void testSetItalic() {
         attr.removeAttributes(attr);
         StyleConstants.setItalic(attr, true);
-        assertTrue(((Boolean)attr.getAttribute(
-                        StyleConstants.Italic)).booleanValue());
+        assertTrue(((Boolean) attr.getAttribute(StyleConstants.Italic)).booleanValue());
         StyleConstants.setItalic(attr, false);
-        assertFalse(((Boolean)attr.getAttribute(
-                         StyleConstants.Italic)).booleanValue());
+        assertFalse(((Boolean) attr.getAttribute(StyleConstants.Italic)).booleanValue());
     }
 
     public void testSetStrikeThrough() {
         attr.removeAttributes(attr);
         StyleConstants.setStrikeThrough(attr, true);
-        assertTrue(((Boolean)attr.getAttribute(
-                        StyleConstants.StrikeThrough)).booleanValue());
+        assertTrue(((Boolean) attr.getAttribute(StyleConstants.StrikeThrough)).booleanValue());
         StyleConstants.setStrikeThrough(attr, false);
-        assertFalse(((Boolean)attr.getAttribute(
-                         StyleConstants.StrikeThrough)).booleanValue());
+        assertFalse(((Boolean) attr.getAttribute(StyleConstants.StrikeThrough)).booleanValue());
     }
 
     public void testSetSubscript() {
         attr.removeAttributes(attr);
         StyleConstants.setSubscript(attr, true);
-        assertTrue(((Boolean)attr.getAttribute(
-                        StyleConstants.Subscript)).booleanValue());
+        assertTrue(((Boolean) attr.getAttribute(StyleConstants.Subscript)).booleanValue());
         StyleConstants.setSubscript(attr, false);
-        assertFalse(((Boolean)attr.getAttribute(
-                         StyleConstants.Subscript)).booleanValue());
+        assertFalse(((Boolean) attr.getAttribute(StyleConstants.Subscript)).booleanValue());
     }
 
     public void testSetSuperscript() {
         attr.removeAttributes(attr);
         StyleConstants.setSuperscript(attr, true);
-        assertTrue(((Boolean)attr.getAttribute(
-                        StyleConstants.Superscript)).booleanValue());
+        assertTrue(((Boolean) attr.getAttribute(StyleConstants.Superscript)).booleanValue());
         StyleConstants.setSuperscript(attr, false);
-        assertFalse(((Boolean)attr.getAttribute(
-                         StyleConstants.Superscript)).booleanValue());
+        assertFalse(((Boolean) attr.getAttribute(StyleConstants.Superscript)).booleanValue());
     }
 
     public void testSetUnderline() {
         attr.removeAttributes(attr);
         StyleConstants.setUnderline(attr, true);
-        assertTrue(((Boolean)attr.getAttribute(
-                        StyleConstants.Underline)).booleanValue());
+        assertTrue(((Boolean) attr.getAttribute(StyleConstants.Underline)).booleanValue());
         StyleConstants.setUnderline(attr, false);
-        assertFalse(((Boolean)attr.getAttribute(
-                         StyleConstants.Underline)).booleanValue());
+        assertFalse(((Boolean) attr.getAttribute(StyleConstants.Underline)).booleanValue());
     }
 
     public void testBackground() {
-        assertEquals(
-                StyleConstants.ColorConstants.class,
-                StyleConstants.Background.getClass());
-        assertEquals(
-                "background",
-                StyleConstants.Background.toString());
+        assertEquals(StyleConstants.ColorConstants.class, StyleConstants.Background.getClass());
+        assertEquals("background", StyleConstants.Background.toString());
     }
 
     public void testGetBackground() {
-        assertTrue(
-            Color.black == StyleConstants.
-                               getBackground(SimpleAttributeSet.EMPTY));
+        assertTrue(Color.black == StyleConstants.getBackground(SimpleAttributeSet.EMPTY));
         Color val = new Color(10, 11, 12);
         putAttribute(StyleConstants.Background, val);
         assertEquals(val, StyleConstants.getBackground(attr));
     }
 
     public void testForeground() {
-        assertEquals(
-            StyleConstants.ColorConstants.class,
-            StyleConstants.Foreground.getClass());
-        assertEquals(
-            "foreground",
-            StyleConstants.Foreground.toString());
+        assertEquals(StyleConstants.ColorConstants.class, StyleConstants.Foreground.getClass());
+        assertEquals("foreground", StyleConstants.Foreground.toString());
     }
 
     public void testGetForeground() {
-        assertTrue(
-            Color.black == StyleConstants.getForeground(
-                               SimpleAttributeSet.EMPTY));
+        assertTrue(Color.black == StyleConstants.getForeground(SimpleAttributeSet.EMPTY));
         Color val = new Color(11, 12, 13);
         putAttribute(StyleConstants.Foreground, val);
         assertEquals(val, StyleConstants.getForeground(attr));
@@ -521,12 +422,9 @@
     }
 
     public void testComponentAttribute() {
-        assertEquals(
-            StyleConstants.CharacterConstants.class,
-            StyleConstants.ComponentAttribute.getClass());
-        assertEquals(
-            "component",
-            StyleConstants.ComponentAttribute.toString());
+        assertEquals(StyleConstants.CharacterConstants.class, StyleConstants.ComponentAttribute
+                .getClass());
+        assertEquals("component", StyleConstants.ComponentAttribute.toString());
     }
 
     public void testGetComponent() {
@@ -540,28 +438,20 @@
         attr.removeAttributes(attr);
         Component val = new JLabel("test component");
         StyleConstants.setComponent(attr, val);
-        assertEquals(AbstractDocument.ElementNameAttribute
-                     + "=component component=" + val + " ",
-                     attr.toString());
+        assertEquals(AbstractDocument.ElementNameAttribute + "=component component=" + val
+                + " ", attr.toString());
         assertEquals(val, attr.getAttribute(StyleConstants.ComponentAttribute));
-        assertEquals(
-            StyleConstants.ComponentElementName,
-            attr.getAttribute(AbstractDocument.ElementNameAttribute));
+        assertEquals(StyleConstants.ComponentElementName, attr
+                .getAttribute(AbstractDocument.ElementNameAttribute));
     }
 
     public void testFontFamily() {
-        assertEquals(
-            StyleConstants.FontConstants.class,
-            StyleConstants.FontFamily.getClass());
-        assertEquals(
-            "family",
-            StyleConstants.FontFamily.toString());
+        assertEquals(StyleConstants.FontConstants.class, StyleConstants.FontFamily.getClass());
+        assertEquals("family", StyleConstants.FontFamily.toString());
     }
 
     public void testGetFontFamily() {
-        assertEquals(
-            "Monospaced",
-            StyleConstants.getFontFamily(SimpleAttributeSet.EMPTY));
+        assertEquals("Monospaced", StyleConstants.getFontFamily(SimpleAttributeSet.EMPTY));
         String val = "arial";
         putAttribute(StyleConstants.FontFamily, val);
         assertEquals(val, StyleConstants.getFontFamily(attr));
@@ -580,11 +470,12 @@
             public int getIconHeight() {
                 return 0;
             }
+
             public int getIconWidth() {
                 return 0;
             }
-            public void paintIcon(final Component arg0, final Graphics arg1,
-                                  final int arg2,
+
+            public void paintIcon(final Component arg0, final Graphics arg1, final int arg2,
                     final int arg3) {
             }
         };
@@ -598,124 +489,74 @@
             public int getIconHeight() {
                 return 0;
             }
+
             public int getIconWidth() {
                 return 0;
             }
-            public void paintIcon(final Component arg0, final Graphics arg1,
-                                  final int arg2,
+
+            public void paintIcon(final Component arg0, final Graphics arg1, final int arg2,
                     final int arg3) {
             }
         };
         StyleConstants.setIcon(attr, val);
-        assertEquals(AbstractDocument.ElementNameAttribute
-                     + "=icon icon=" + val + " ",
-                     attr.toString());
+        assertEquals(AbstractDocument.ElementNameAttribute + "=icon icon=" + val + " ", attr
+                .toString());
         assertEquals(val, attr.getAttribute(StyleConstants.IconAttribute));
-        assertEquals(
-            StyleConstants.IconElementName,
-            attr.getAttribute(AbstractDocument.ElementNameAttribute));
+        assertEquals(StyleConstants.IconElementName, attr
+                .getAttribute(AbstractDocument.ElementNameAttribute));
     }
 
     public void testTabSet() {
-        assertEquals(
-            StyleConstants.ParagraphConstants.class,
-            StyleConstants.TabSet.getClass());
-        assertEquals(
-            "TabSet",
-            StyleConstants.TabSet.toString());
+        assertEquals(StyleConstants.ParagraphConstants.class, StyleConstants.TabSet.getClass());
+        assertEquals("TabSet", StyleConstants.TabSet.toString());
     }
 
     public void testGetTabSet() {
         assertNull(StyleConstants.getTabSet(SimpleAttributeSet.EMPTY));
-        TabSet val = new TabSet(new TabStop[] {new TabStop(0.1f)});
+        TabSet val = new TabSet(new TabStop[] { new TabStop(0.1f) });
         putAttribute(StyleConstants.TabSet, val);
         assertEquals(val, StyleConstants.getTabSet(attr));
     }
 
     public void testSetTabSet() {
         attr.removeAttributes(attr);
-        TabSet val = new TabSet(new TabStop[] {new TabStop(0.2f)});
+        TabSet val = new TabSet(new TabStop[] { new TabStop(0.2f) });
         StyleConstants.setTabSet(attr, val);
         assertEquals(val, attr.getAttribute(StyleConstants.TabSet));
     }
 
     public void testNameAttribute() {
-        assertEquals(
-            StyleConstants.class,
-            StyleConstants.NameAttribute.getClass());
-        assertEquals(
-            "name",
-            StyleConstants.NameAttribute.toString());
+        assertEquals(StyleConstants.class, StyleConstants.NameAttribute.getClass());
+        assertEquals("name", StyleConstants.NameAttribute.toString());
     }
 
     public void testResolveAttribute() {
-        assertEquals(
-            StyleConstants.class,
-            StyleConstants.ResolveAttribute.getClass());
-        assertEquals(
-            "resolver",
-            StyleConstants.ResolveAttribute.toString());
+        assertEquals(StyleConstants.class, StyleConstants.ResolveAttribute.getClass());
+        assertEquals("resolver", StyleConstants.ResolveAttribute.toString());
     }
 
     public void testModelAttribute() {
-        assertEquals(
-            StyleConstants.class,
-            StyleConstants.ModelAttribute.getClass());
-        assertEquals(
-            "model",
-            StyleConstants.ModelAttribute.toString());
+        assertEquals(StyleConstants.class, StyleConstants.ModelAttribute.getClass());
+        assertEquals("model", StyleConstants.ModelAttribute.toString());
     }
 
     public void testCharacterConstants() {
-        assertEquals(
-            StyleConstants.ColorConstants.class,
-            StyleConstants.CharacterConstants.Background.getClass());
-        assertEquals(
-            "background",
-            StyleConstants.CharacterConstants.Background.toString());
-
-        assertEquals(
-            StyleConstants.ColorConstants.class,
-            StyleConstants.CharacterConstants.Foreground.getClass());
-        assertEquals(
-            "foreground",
-            StyleConstants.CharacterConstants.Foreground.toString());
-
-        assertEquals(
-            StyleConstants.FontConstants.class,
-            StyleConstants.CharacterConstants.Family.getClass());
-        assertEquals(
-            "family",
-            StyleConstants.CharacterConstants.Family.toString());
-
-        assertEquals(
-            StyleConstants.FontConstants.class,
-            StyleConstants.CharacterConstants.Size.getClass());
-        assertEquals(
-            "size",
-            StyleConstants.CharacterConstants.Size.toString());
-
-        assertEquals(
-            StyleConstants.FontConstants.class,
-            StyleConstants.CharacterConstants.Bold.getClass());
-        assertEquals(
-            "bold",
-            StyleConstants.CharacterConstants.Bold.toString());
-
-        assertEquals(
-            StyleConstants.FontConstants.class,
-            StyleConstants.CharacterConstants.Italic.getClass());
-        assertEquals(
-            "italic",
-            StyleConstants.CharacterConstants.Italic.toString());
+        assertEquals(StyleConstants.ColorConstants.class, StyleConstants.Background.getClass());
+        assertEquals("background", StyleConstants.Background.toString());
+        assertEquals(StyleConstants.ColorConstants.class, StyleConstants.Foreground.getClass());
+        assertEquals("foreground", StyleConstants.Foreground.toString());
+        assertEquals(StyleConstants.FontConstants.class, StyleConstants.Family.getClass());
+        assertEquals("family", StyleConstants.Family.toString());
+        assertEquals(StyleConstants.FontConstants.class, StyleConstants.Size.getClass());
+        assertEquals("size", StyleConstants.Size.toString());
+        assertEquals(StyleConstants.FontConstants.class, StyleConstants.Bold.getClass());
+        assertEquals("bold", StyleConstants.Bold.toString());
+        assertEquals(StyleConstants.FontConstants.class, StyleConstants.Italic.getClass());
+        assertEquals("italic", StyleConstants.Italic.toString());
     }
 
     public void testComposedTextAttribute() {
-        assertEquals(
-            StyleConstants.class,
-            StyleConstants.CharacterConstants.ComposedTextAttribute.getClass());
-        assertEquals(
-            "composed text",
-            StyleConstants.CharacterConstants.ComposedTextAttribute.toString());
+        assertEquals(StyleConstants.class, StyleConstants.ComposedTextAttribute.getClass());
+        assertEquals("composed text", StyleConstants.ComposedTextAttribute.toString());
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleContextTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleContextTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleContextTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleContextTest.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$
@@ -26,12 +25,10 @@
 import java.lang.reflect.Field;
 import java.util.Enumeration;
 import java.util.Map;
-
 import javax.swing.BasicSwingTestCase;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 import javax.swing.text.StyleContext.SmallAttributeSet;
-
 import junit.framework.TestCase;
 
 public class StyleContextTest extends TestCase implements ChangeListener {
@@ -39,20 +36,18 @@
      * Shared style context object
      */
     protected static StyleContext sc;
+
     /**
      * The array of attribute key-value pair that is shared in the tests.
      */
-    protected static final Object[] attr = {
-            StyleConstants.Bold,            Boolean.TRUE,
-            StyleConstants.Italic,          Boolean.TRUE,
-            StyleConstants.Underline,       Boolean.TRUE,
-            StyleConstants.StrikeThrough,   Boolean.TRUE,
-            StyleConstants.Alignment,       new Integer(1),
-            StyleConstants.Background,      Color.WHITE,
-            StyleConstants.FirstLineIndent, new Float(0.75),
-            StyleConstants.FontFamily,      new String("monospaced"),
-            StyleConstants.FontSize,        new Integer(10),
-            StyleConstants.Foreground,      Color.BLACK };
+    protected static final Object[] attr = { StyleConstants.Bold, Boolean.TRUE,
+            StyleConstants.Italic, Boolean.TRUE, StyleConstants.Underline, Boolean.TRUE,
+            StyleConstants.StrikeThrough, Boolean.TRUE, StyleConstants.Alignment,
+            new Integer(1), StyleConstants.Background, Color.WHITE,
+            StyleConstants.FirstLineIndent, new Float(0.75), StyleConstants.FontFamily,
+            new String("monospaced"), StyleConstants.FontSize, new Integer(10),
+            StyleConstants.Foreground, Color.BLACK };
+
     /**
      * Tracks that a change listener was been called.
      */
@@ -66,19 +61,16 @@
      * @param count the number of attributes to add
      * @return new attribute set with attributes added
      */
-    protected static AttributeSet addAttribute(AttributeSet as, int start,
-                                               int count) {
+    protected static AttributeSet addAttribute(AttributeSet as, int start, int count) {
         if (as == null) {
             as = sc.getEmptySet();
         }
-
         start <<= 1;
         count <<= 1;
-        count  += start;
+        count += start;
         for (int i = start; i < count; i += 2) {
             as = sc.addAttribute(as, attr[i], attr[i + 1]);
         }
-
         return as;
     }
 
@@ -90,8 +82,7 @@
      * @return new attribute set with attributes added
      * @see StyleContextTest#addAttribute(AttributeSet, int, int)
      */
-    protected static AttributeSet addAttribute(final AttributeSet as,
-                                               final int count) {
+    protected static AttributeSet addAttribute(final AttributeSet as, final int count) {
         return addAttribute(as, 0, count);
     }
 
@@ -111,11 +102,11 @@
      * Wrapper to access StyleContext.cache field.
      * @return style context's cache
      */
-    protected static Map getSCCache() {
+    protected static Map<?, ?> getSCCache() {
         try {
             Field f = sc.getClass().getDeclaredField("cache");
             f.setAccessible(true);
-            return (Map)(f.get(sc));
+            return (Map<?, ?>) (f.get(sc));
         } catch (IllegalAccessException e) {
             fail(e.getMessage());
         } catch (NoSuchFieldException e) {
@@ -128,11 +119,11 @@
      * Wrapper to access StyleContext.fontCache field.
      * @return style context's cache
      */
-    protected static Map getSCFontCache() {
+    protected static Map<?, ?> getSCFontCache() {
         try {
             Field f = sc.getClass().getDeclaredField("fontCache");
             f.setAccessible(true);
-            return (Map)(f.get(sc));
+            return (Map<?, ?>) (f.get(sc));
         } catch (IllegalAccessException e) {
             fail(e.getMessage());
         } catch (NoSuchFieldException e) {
@@ -144,6 +135,7 @@
     /*
      * @see TestCase#setUp()
      */
+    @Override
     protected void setUp() throws Exception {
         sc = new StyleContext();
     }
@@ -154,15 +146,14 @@
      */
     public void testStyleContext() {
         int count = 0;
-        Enumeration names = sc.getStyleNames();
-        Object      name = null;
+        Enumeration<?> names = sc.getStyleNames();
+        Object name = null;
         while (names.hasMoreElements()) {
             name = names.nextElement();
             count++;
         }
-
         assertEquals(1, count);
-        assertEquals("default", (String)name);
+        assertEquals("default", (String) name);
     }
 
     public void testCollectGarbageInCache() {
@@ -170,30 +161,23 @@
             // This is internal test only
             return;
         }
-
-        Map cache = getSCCache();
-
+        Map<?, ?> cache = getSCCache();
         assertEquals(2, cache.size());
-
         // Create an attribute set containing 10 items. This will
         // create sets with items from 1 to 10
         addAttribute(10);
-
         // The sets with number of items from 1 up to 9 will be cached
         // (Plus attribute set to support styles: the named style itself
         //  with "name" attribute and the reference to this style from
         //  the internal list of styles)
         assertEquals(9 + 2, cache.size());
-
         // Run the garbage collector several times
         for (int i = 0; i < 20; i++) {
             System.gc();
         }
-
         // Create an attribute set cotaining one and only item. This will
         // lead to a call to collectGarbageInCache method
         addAttribute(1);
-
         // The cache has been cleared but the newly created set is cached
         assertEquals(1 + 2, cache.size());
     }
@@ -203,39 +187,31 @@
             // This is internal test only
             return;
         }
-
-        Map fontCache = getSCFontCache();
-
+        Map<?, ?> fontCache = getSCFontCache();
         assertEquals(0, fontCache.size());
-
-        sc.getFont("Arial",  Font.BOLD,  14);
-        sc.getFont("Tahoma", Font.PLAIN,  8);
-
+        sc.getFont("Arial", Font.BOLD, 14);
+        sc.getFont("Tahoma", Font.PLAIN, 8);
         assertEquals(2, fontCache.size());
-
         // Run the garbage collector several times
         for (int i = 0; i < 5; i++) {
             System.gc();
         }
-
         // Create an attribute set cotaining one and only item. This will
         // lead to a call to collectGarbageInCache method
         addAttribute(1);
-
         // The cache has been cleared but the newly created set is cached
         assertEquals(0, fontCache.size());
     }
 
     public void testAddStyle() {
-        Style aStyle       = sc.addStyle("aStyle", null);
+        Style aStyle = sc.addStyle("aStyle", null);
         Style anotherStyle = sc.addStyle("anotherStyle", aStyle);
-
         int count = 0;
-        boolean[] was = {false, false, false};
+        boolean[] was = { false, false, false };
         String styleNames = new String();
-        Enumeration names = sc.getStyleNames();
+        Enumeration<?> names = sc.getStyleNames();
         while (names.hasMoreElements()) {
-            String name = (String)names.nextElement();
+            String name = (String) names.nextElement();
             styleNames += name + " ";
             if (name == "aStyle") {
                 assertSame(aStyle, sc.getStyle(name));
@@ -258,33 +234,25 @@
             }
             count++;
         }
-
         assertEquals(3, count);
         for (int i = 0; i < was.length; i++) {
-            assertTrue("The style named '" +
-                       (i == 0 ? "aStyle" :
-                        (i == 1 ? "anotherStyle" : "default")) +
-                       "' was not in the list.", was[i]);
+            assertTrue("The style named '"
+                    + (i == 0 ? "aStyle" : (i == 1 ? "anotherStyle" : "default"))
+                    + "' was not in the list.", was[i]);
         }
     }
 
     public void testAddStyleMisc() {
         // Add styles with diff parameters
-        Object[] styles = {
-                null,  null,
-                "one", null,
-                null,  sc.new NamedStyle(),
-                "two", sc.new NamedStyle()
-        };
-
+        Object[] styles = { null, null, "one", null, null, sc.new NamedStyle(), "two",
+                sc.new NamedStyle() };
         for (int i = 0; i < styles.length; i += 2) {
-            Style style = sc.addStyle((String)styles[i], (Style)styles[i + 1]);
-            assertEquals("Iteration: " + i, (String)styles[i], style.getName());
-            assertSame("Iteration: " + i, styles[i + 1],
-                       style.getResolveParent());
+            Style style = sc.addStyle((String) styles[i], (Style) styles[i + 1]);
+            assertEquals("Iteration: " + i, (String) styles[i], style.getName());
+            assertSame("Iteration: " + i, styles[i + 1], style.getResolveParent());
         }
     }
-    
+
     public void testAddStyleTwice() {
         final String styleName = "styleName";
         final Style style = sc.addStyle(styleName, null);
@@ -303,11 +271,10 @@
     public void testGetStyle() {
         Style style = sc.getStyle("default");
         assertEquals("default", style.getName());
-
         sc.addStyle("aStyle", style);
         style = sc.getStyle("aStyle");
         assertEquals("aStyle", style.getName());
-        assertEquals("default", ((Style)style.getResolveParent()).getName());
+        assertEquals("default", ((Style) style.getResolveParent()).getName());
     }
 
     public void testCreateLargeAttributeSet() {
@@ -317,7 +284,6 @@
 
     public void testGetEmptySet() {
         assertSame(sc.getEmptySet(), sc.getEmptySet());
-
         assertEquals(0, sc.getEmptySet().getAttributeCount());
     }
 
@@ -326,12 +292,10 @@
         bStateChanged = false;
         sc.addStyle("one", null);
         assertFalse(bStateChanged);
-
         sc.addChangeListener(this);
         bStateChanged = false;
         sc.addStyle("two", null);
         assertTrue(bStateChanged);
-
         sc.removeChangeListener(this);
         bStateChanged = false;
         sc.addStyle("three", null);
@@ -342,19 +306,16 @@
     public void testChangeListenerAddStyleNull() {
         sc.addChangeListener(this);
         bStateChanged = false;
-        sc.addStyle(null,
-                    StyleContext.getDefaultStyleContext().new NamedStyle());
+        sc.addStyle(null, StyleContext.getDefaultStyleContext().new NamedStyle());
         assertFalse(bStateChanged);
-
         int count = 0;
         boolean wasNull = false;
-        Enumeration names = sc.getStyleNames();
+        Enumeration<?> names = sc.getStyleNames();
         while (names.hasMoreElements()) {
             Object name = names.nextElement();
             wasNull = wasNull || name == null;
             count++;
         }
-
         assertEquals(1, count);
         assertFalse(wasNull);
     }
@@ -364,16 +325,13 @@
         sc.addStyle("one", null);
         sc.addStyle("two", null);
         sc.addStyle("three", null);
-
         bStateChanged = false;
         sc.removeStyle("one");
         assertFalse(bStateChanged);
-
         sc.addChangeListener(this);
         bStateChanged = false;
         sc.removeStyle("two");
         assertTrue(bStateChanged);
-
         sc.removeChangeListener(this);
         bStateChanged = false;
         sc.removeStyle("three");
@@ -383,11 +341,9 @@
     public void testGetChangeListeners() {
         ChangeListener[] listeners = sc.getChangeListeners();
         assertEquals(0, listeners.length);
-
         sc.addChangeListener(this);
         listeners = sc.getChangeListeners();
         assertEquals(1, listeners.length);
-
         sc.removeChangeListener(this);
         listeners = sc.getChangeListeners();
         assertEquals(0, listeners.length);
@@ -396,31 +352,28 @@
     public void testGetStyleNamesDef() {
         boolean wasDefault = false;
         int count = 0;
-        Enumeration names = sc.getStyleNames();
+        Enumeration<?> names = sc.getStyleNames();
         while (names.hasMoreElements()) {
-            String name = (String)names.nextElement();
+            String name = (String) names.nextElement();
             wasDefault = name == "default";
             count++;
         }
-
         assertEquals(1, count);
         assertTrue(wasDefault);
     }
 
     public void testGetStyleNames() {
         sc.addStyle("style", null);
-
         boolean wasDefault = false;
-        boolean wasStyle   = false;
+        boolean wasStyle = false;
         int count = 0;
-        Enumeration names = sc.getStyleNames();
+        Enumeration<?> names = sc.getStyleNames();
         while (names.hasMoreElements()) {
-            String name = (String)names.nextElement();
+            String name = (String) names.nextElement();
             wasDefault = wasDefault || name == "default";
-            wasStyle   = wasStyle   || name == "style";
+            wasStyle = wasStyle || name == "style";
             count++;
         }
-
         assertEquals(2, count);
         assertTrue(wasDefault);
         assertTrue(wasStyle);
@@ -429,18 +382,16 @@
     public void testRemoveStyle() {
         sc.addStyle("style", null);
         sc.removeStyle("style");
-
         boolean wasDefault = false;
-        boolean wasStyle   = false;
+        boolean wasStyle = false;
         int count = 0;
-        Enumeration names = sc.getStyleNames();
+        Enumeration<?> names = sc.getStyleNames();
         while (names.hasMoreElements()) {
-            String name = (String)names.nextElement();
+            String name = (String) names.nextElement();
             wasDefault = wasDefault || "default".equals(name);
-            wasStyle   = wasStyle   || "style".equals(name);
+            wasStyle = wasStyle || "style".equals(name);
             count++;
         }
-
         assertEquals(1, count);
         assertTrue(wasDefault);
         assertFalse(wasStyle);
@@ -450,46 +401,35 @@
         Style style = sc.getStyle(StyleContext.DEFAULT_STYLE);
         style.addAttribute(StyleConstants.Bold, Boolean.TRUE);
         style.addAttribute(StyleConstants.Italic, Boolean.FALSE);
-
         style = sc.addStyle("aStyle", null);
         style.addAttribute(StyleConstants.FontFamily, "Arial");
         style.addAttribute(StyleConstants.FontSize, new Integer(14));
-
         sc.getFont(style);
-
-        String[] asStr = new String[] {
-            "{family=Arial,name=aStyle,size=14,}",
-            "{default=AttributeSet,}",
-            "{family=Arial,name=aStyle,}",
-            "{aStyle=AttributeSet,default=AttributeSet,}",
-            "{italic=false,bold=true,name=default,}",
-            "{name=default,}",
-            "{name=aStyle,}",
-            "{name=default,bold=true,}",
-        };
+        String[] asStr = new String[] { "{family=Arial,name=aStyle,size=14,}",
+                "{default=AttributeSet,}", "{family=Arial,name=aStyle,}",
+                "{aStyle=AttributeSet,default=AttributeSet,}",
+                "{italic=false,bold=true,name=default,}", "{name=default,}", "{name=aStyle,}",
+                "{name=default,bold=true,}", };
         String scStr = sc.toString();
         assertNotNull(scStr);
-
         String[] splitStrs = scStr.replaceAll("\r", "").split("\n");
         assertEquals(asStr.length, splitStrs.length);
         boolean[] met = new boolean[splitStrs.length];
         for (int i = 0; i < splitStrs.length; i++) {
             for (int j = 0; j < asStr.length; j++) {
                 if (asStr[j].length() == splitStrs[i].length()
-                    && assertAttributes(trimEnds(asStr[j]).split(","),
-                                        trimEnds(splitStrs[i]).split(","))) {
+                        && assertAttributes(trimEnds(asStr[j]).split(","), trimEnds(
+                                splitStrs[i]).split(","))) {
                     met[j] = true;
                 }
             }
         }
-
         for (int i = 0; i < met.length; i++) {
             assertTrue("asStr[" + i + "] is missing", met[i]);
         }
     }
 
-    public static boolean assertAttributes(final String[] expAttrs,
-                                           final String[] realAttrs) {
+    public static boolean assertAttributes(final String[] expAttrs, final String[] realAttrs) {
         if (expAttrs.length != realAttrs.length) {
             return false;
         }
@@ -522,20 +462,17 @@
 
     public void testGetDefaultStyleContext() {
         StyleContext def;
-        assertSame(def = StyleContext.getDefaultStyleContext(),
-                   StyleContext.getDefaultStyleContext());
-
-        int         count = 0;
-        Enumeration names = def.getStyleNames();
-        Object      name  = null;
-
+        assertSame(def = StyleContext.getDefaultStyleContext(), StyleContext
+                .getDefaultStyleContext());
+        int count = 0;
+        Enumeration<?> names = def.getStyleNames();
+        Object name = null;
         while (names.hasMoreElements()) {
-             count++;
-             name = names.nextElement();
+            count++;
+            name = names.nextElement();
         }
-
         assertEquals(1, count);
-        assertEquals(StyleContext.DEFAULT_STYLE, (String)name);
+        assertEquals(StyleContext.DEFAULT_STYLE, (String) name);
     }
 
     /**
@@ -543,7 +480,10 @@
      * Stores values returned by createSmallAttributeSet in array.
      */
     private static class StyleContextX extends StyleContext {
+        private static final long serialVersionUID = 1L;
+
         public int count;
+
         public AttributeSet[] attrSet;
 
         public StyleContextX() {
@@ -551,48 +491,39 @@
             attrSet = new AttributeSet[20];
         }
 
-        public SmallAttributeSet
-            createSmallAttributeSet(final AttributeSet a) {
-
+        @Override
+        public SmallAttributeSet createSmallAttributeSet(final AttributeSet a) {
             if (attrSet == null) {
                 // This condition is true in StyleContext's constructor
                 return super.createSmallAttributeSet(a);
             }
-
             attrSet[count] = super.createSmallAttributeSet(a);
-            return (SmallAttributeSet)attrSet[count++];
+            return (SmallAttributeSet) attrSet[count++];
         }
 
-        public MutableAttributeSet
-            createLargeAttributeSet(final AttributeSet a) {
-
+        @Override
+        public MutableAttributeSet createLargeAttributeSet(final AttributeSet a) {
             attrSet[count] = super.createLargeAttributeSet(a);
-            return (MutableAttributeSet)attrSet[count++];
+            return (MutableAttributeSet) attrSet[count++];
         }
-
     }
 
     public void testCaching() {
         StyleContextX sc = new StyleContextX();
-
         int addStyle = sc.count;
         sc.addStyle("aStyle", null);
-        int addAttr  = sc.count;
-        AttributeSet as = sc.addAttribute(sc.getEmptySet(),
-                                          AttributeSet.NameAttribute,
-                                          "aStyle");
-
+        int addAttr = sc.count;
+        AttributeSet as = sc.addAttribute(sc.getEmptySet(), AttributeSet.NameAttribute,
+                "aStyle");
         assertFalse(addStyle == addAttr);
         assertSame(sc.attrSet[addStyle], as);
     }
 
     /*
-    public void testReclaim() {
-    }
-    */
-
+     public void testReclaim() {
+     }
+     */
     public void stateChanged(final ChangeEvent event) {
         bStateChanged = true;
     }
-
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleContext_AddAttrTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleContext_AddAttrTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleContext_AddAttrTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleContext_AddAttrTest.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$
@@ -23,7 +22,6 @@
 
 import javax.swing.BasicSwingTestCase;
 import javax.swing.text.StyleContext.SmallAttributeSet;
-
 import junit.framework.TestCase;
 
 /**
@@ -38,15 +36,11 @@
      * The cache should return the same objects.
      */
     public void testAddAttributeCacheDiffOrder() {
-        AttributeSet as1 = sc.addAttribute(sc.getEmptySet(),
-                StyleConstants.Bold,   Boolean.TRUE);
-        AttributeSet as2 = sc.addAttribute(as1,
-                StyleConstants.Italic, Boolean.FALSE);
-        AttributeSet as12 = sc.addAttribute(sc.getEmptySet(),
-                StyleConstants.Italic, Boolean.FALSE);
-        AttributeSet as22 = sc.addAttribute(as12,
-                StyleConstants.Bold,   Boolean.TRUE);
-
+        AttributeSet as1 = sc.addAttribute(sc.getEmptySet(), StyleConstants.Bold, Boolean.TRUE);
+        AttributeSet as2 = sc.addAttribute(as1, StyleConstants.Italic, Boolean.FALSE);
+        AttributeSet as12 = sc.addAttribute(sc.getEmptySet(), StyleConstants.Italic,
+                Boolean.FALSE);
+        AttributeSet as22 = sc.addAttribute(as12, StyleConstants.Bold, Boolean.TRUE);
         assertSame(as2, as22);
         assertEquals(2, as2.getAttributeCount());
     }
@@ -56,15 +50,12 @@
      * The cache should return the same objects.
      */
     public void testAddAttributeCacheSameOrder() {
-        AttributeSet as11 = sc.addAttribute(sc.getEmptySet(),
-                StyleConstants.Bold,   Boolean.TRUE);
-        AttributeSet as21 = sc.addAttribute(as11,
-                StyleConstants.Italic, Boolean.FALSE);
-        AttributeSet as12 = sc.addAttribute(sc.getEmptySet(),
-                StyleConstants.Bold,   Boolean.TRUE);
-        AttributeSet as22 = sc.addAttribute(as12,
-                StyleConstants.Italic, Boolean.FALSE);
-
+        AttributeSet as11 = sc
+                .addAttribute(sc.getEmptySet(), StyleConstants.Bold, Boolean.TRUE);
+        AttributeSet as21 = sc.addAttribute(as11, StyleConstants.Italic, Boolean.FALSE);
+        AttributeSet as12 = sc
+                .addAttribute(sc.getEmptySet(), StyleConstants.Bold, Boolean.TRUE);
+        AttributeSet as22 = sc.addAttribute(as12, StyleConstants.Italic, Boolean.FALSE);
         assertSame(as11, as12);
         assertSame(as21, as22);
         assertEquals(1, as11.getAttributeCount());
@@ -76,11 +67,9 @@
      * Check the return instances are different.
      */
     public void testAddAttributeDiff() {
-        AttributeSet as1 = sc.addAttribute(sc.getEmptySet(),
-                StyleConstants.Bold, Boolean.TRUE);
-        AttributeSet as2 = sc.addAttribute(sc.getEmptySet(),
-                StyleConstants.Bold, Boolean.FALSE);
-
+        AttributeSet as1 = sc.addAttribute(sc.getEmptySet(), StyleConstants.Bold, Boolean.TRUE);
+        AttributeSet as2 = sc
+                .addAttribute(sc.getEmptySet(), StyleConstants.Bold, Boolean.FALSE);
         assertNotSame(as1, as2);
     }
 
@@ -89,7 +78,6 @@
      */
     public void testAddAttributeNine() {
         AttributeSet as = StyleContextTest.addAttribute(9);
-
         assertEquals(9, as.getAttributeCount());
         assertTrue(as instanceof SmallAttributeSet);
     }
@@ -101,7 +89,6 @@
     public void testAddAttributeNineSameValue() {
         AttributeSet as = StyleContextTest.addAttribute(9);
         as = sc.addAttribute(as, StyleConstants.Bold, Boolean.TRUE);
-
         assertEquals(9, as.getAttributeCount());
         if (!BasicSwingTestCase.isHarmony()) {
             assertTrue(as instanceof SimpleAttributeSet);
@@ -117,7 +104,6 @@
     public void testAddAttributeSame() {
         AttributeSet as1 = StyleContextTest.addAttribute(null, 1);
         AttributeSet as2 = StyleContextTest.addAttribute(null, 1);
-
         assertSame(as1, as2);
     }
 
@@ -126,11 +112,10 @@
      * Check the returned sets are the same.
      */
     public void testAddAttributeSimilar() {
-        AttributeSet as1 = sc.addAttribute(sc.getEmptySet(),
-                StyleConstants.FontSize, new Integer(10));
-        AttributeSet as2 = sc.addAttribute(sc.getEmptySet(),
-                StyleConstants.FontSize, new Integer(10));
-
+        AttributeSet as1 = sc.addAttribute(sc.getEmptySet(), StyleConstants.FontSize,
+                new Integer(10));
+        AttributeSet as2 = sc.addAttribute(sc.getEmptySet(), StyleConstants.FontSize,
+                new Integer(10));
         assertSame(as1, as2);
     }
 
@@ -139,11 +124,9 @@
      * different objects.
      */
     public void testAddAttributeSimilarTwice() {
-        AttributeSet as1 = sc.addAttribute(sc.getEmptySet(),
-                StyleConstants.FontSize, new Integer(10));
-        AttributeSet as2 = sc.addAttribute(as1,
-                StyleConstants.FontSize, new Integer(10));
-
+        AttributeSet as1 = sc.addAttribute(sc.getEmptySet(), StyleConstants.FontSize,
+                new Integer(10));
+        AttributeSet as2 = sc.addAttribute(as1, StyleConstants.FontSize, new Integer(10));
         assertSame(as1, as2);
         assertEquals(1, as1.getAttributeCount());
     }
@@ -153,7 +136,6 @@
      */
     public void testAddAttributeTen() {
         AttributeSet as = StyleContextTest.addAttribute(10);
-
         assertEquals(10, as.getAttributeCount());
         assertTrue(as instanceof SimpleAttributeSet);
     }
@@ -163,7 +145,6 @@
      */
     public void testAddAttributeThree() {
         AttributeSet as = StyleContextTest.addAttribute(3);
-
         assertEquals(3, as.getAttributeCount());
         assertTrue(as instanceof SmallAttributeSet);
     }
@@ -175,7 +156,6 @@
     public void testAddAttributeThreeSameKey() {
         AttributeSet as = StyleContextTest.addAttribute(3);
         as = sc.addAttribute(as, StyleConstants.Bold, Boolean.FALSE);
-
         assertEquals(3, as.getAttributeCount());
         assertTrue(as instanceof SmallAttributeSet);
     }
@@ -185,7 +165,6 @@
      */
     public void testAddAttributeTwo() {
         AttributeSet as = StyleContextTest.addAttribute(2);
-
         assertEquals(2, as.getAttributeCount());
         assertTrue(as instanceof SmallAttributeSet);
     }
@@ -196,21 +175,18 @@
      */
     public void testAddMutable() {
         AttributeSet as = StyleContextTest.addAttribute(3);
-
         SimpleAttributeSet sas = new SimpleAttributeSet();
         int i;
         for (i = 0; i < 4; i += 2) {
-            sas.addAttribute(StyleContextTest.attr[i],
-                             StyleContextTest.attr[i + 1]);
+            sas.addAttribute(StyleContextTest.attr[i], StyleContextTest.attr[i + 1]);
         }
-
         AttributeSet set = sc.addAttribute(sas, StyleContextTest.attr[i],
-                                           StyleContextTest.attr[i + 1]);
-
+                StyleContextTest.attr[i + 1]);
         assertEquals(3, set.getAttributeCount());
         assertSame(as, set);
     }
 
+    @Override
     protected void setUp() {
         sc = StyleContextTest.sc = new StyleContext();
     }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleContext_AddAttrsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleContext_AddAttrsTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleContext_AddAttrsTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleContext_AddAttrsTest.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$
@@ -23,7 +22,6 @@
 
 import javax.swing.BasicSwingTestCase;
 import javax.swing.text.StyleContext.SmallAttributeSet;
-
 import junit.framework.TestCase;
 
 /**
@@ -36,9 +34,7 @@
     public void testAddAttributesNine() {
         AttributeSet as1 = StyleContextTest.addAttribute(5);
         AttributeSet as2 = StyleContextTest.addAttribute(null, 5, 4);
-
         AttributeSet test = sc.addAttributes(as1, as2);
-
         assertEquals(9, test.getAttributeCount());
         assertTrue(test instanceof SmallAttributeSet);
     }
@@ -46,9 +42,7 @@
     public void testAddAttributesNineAndNine() {
         AttributeSet as1 = StyleContextTest.addAttribute(9);
         AttributeSet as2 = StyleContextTest.addAttribute(9);
-
         AttributeSet test = sc.addAttributes(as1, as2);
-
         assertEquals(9, test.getAttributeCount());
         if (!BasicSwingTestCase.isHarmony()) {
             assertTrue(test instanceof SimpleAttributeSet);
@@ -60,9 +54,7 @@
     public void testAddAttributesNineFull() {
         AttributeSet as1 = StyleContextTest.addAttribute(8);
         AttributeSet as2 = StyleContextTest.addAttribute(9);
-
         AttributeSet test = sc.addAttributes(as1, as2);
-
         assertEquals(9, test.getAttributeCount());
         if (!BasicSwingTestCase.isHarmony()) {
             assertTrue(test instanceof SimpleAttributeSet);
@@ -73,14 +65,10 @@
 
     public void testAddAttributesSameValues() {
         AttributeSet as1 = StyleContextTest.addAttribute(2);
-        AttributeSet as2 =
-            new SimpleAttributeSet(StyleContextTest.addAttribute(2));
-
+        AttributeSet as2 = new SimpleAttributeSet(StyleContextTest.addAttribute(2));
         assertNotSame(as1, as2);
         assertEquals(2, as2.getAttributeCount());
-
         AttributeSet test = sc.addAttributes(as1, as2);
-
         assertSame(as1, test);
         assertEquals(2, test.getAttributeCount());
     }
@@ -88,9 +76,7 @@
     public void testAddAttributesTen() {
         AttributeSet as1 = StyleContextTest.addAttribute(5);
         AttributeSet as2 = StyleContextTest.addAttribute(null, 5, 5);
-
         AttributeSet test = sc.addAttributes(as1, as2);
-
         assertEquals(10, test.getAttributeCount());
         assertTrue(test instanceof SimpleAttributeSet);
     }
@@ -99,25 +85,20 @@
         AttributeSet as1 = StyleContextTest.addAttribute(9);
         AttributeSet as2 = StyleContextTest.addAttribute(9);
         as2 = sc.addAttribute(as2, StyleConstants.LineSpacing, new Float(0.5));
-
         AttributeSet test = sc.addAttributes(as1, as2);
-
         assertEquals(10, test.getAttributeCount());
         assertTrue(test instanceof SimpleAttributeSet);
     }
 
     public void testAddAttributesThreeSame() {
-        AttributeSet as = sc.addAttributes(StyleContextTest.addAttribute(3),
-                                           StyleContextTest.addAttribute(1));
-
+        AttributeSet as = sc.addAttributes(StyleContextTest.addAttribute(3), StyleContextTest
+                .addAttribute(1));
         assertEquals(3, as.getAttributeCount());
     }
 
     public void testAddAttributesThreeSameKey() {
-        AttributeSet as = sc.addAttributes(StyleContextTest.addAttribute(3),
-                sc.addAttribute(sc.getEmptySet(), StyleContextTest.attr[0],
-                                Boolean.FALSE));
-
+        AttributeSet as = sc.addAttributes(StyleContextTest.addAttribute(3), sc.addAttribute(sc
+                .getEmptySet(), StyleContextTest.attr[0], Boolean.FALSE));
         assertEquals(3, as.getAttributeCount());
         assertEquals(Boolean.FALSE, as.getAttribute(StyleContextTest.attr[0]));
     }
@@ -126,13 +107,12 @@
         AttributeSet as1 = StyleContextTest.addAttribute(5);
         AttributeSet as2 = StyleContextTest.addAttribute(null, 5, 3);
         as2 = sc.addAttribute(as2, StyleConstants.LineSpacing, new Float(0.5));
-
         AttributeSet test = sc.addAttributes(as1, as2);
-
         assertEquals(9, test.getAttributeCount());
         assertTrue(test instanceof SmallAttributeSet);
     }
 
+    @Override
     protected void setUp() throws Exception {
         sc = StyleContextTest.sc = new StyleContext();
     }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleContext_NamedStyleTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleContext_NamedStyleTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleContext_NamedStyleTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleContext_NamedStyleTest.java Sun Nov 26 12:15:43 2006
@@ -22,7 +22,6 @@
 
 import java.util.Enumeration;
 import java.util.EventListener;
-
 import javax.swing.BasicSwingTestCase;
 import javax.swing.event.CaretListener;
 import javax.swing.event.ChangeListener;
@@ -30,12 +29,13 @@
 
 public class StyleContext_NamedStyleTest extends StyleTest {
     protected NamedStyle ns;
+
     protected NamedStyle withName;
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
-        ns = (NamedStyle)style;
-
+        ns = (NamedStyle) style;
         StyleContext defContext = StyleContext.getDefaultStyleContext();
         withName = defContext.new NamedStyle("styleName", null);
     }
@@ -56,9 +56,7 @@
      * NamedStyle(String, Style)
      */
     public void testNamedStyleStringNullStyle() {
-        Style parent =
-            StyleContext.getDefaultStyleContext().new NamedStyle("parentName",
-                null);
+        Style parent = StyleContext.getDefaultStyleContext().new NamedStyle("parentName", null);
         parent.addAttribute("key", "value");
         ns = StyleContext.getDefaultStyleContext().new NamedStyle(null, parent);
         assertEquals(parent, ns.getResolveParent());
@@ -74,8 +72,7 @@
      * NamedStyle(String, Style)
      */
     public void testNamedStyleStringStyleNull() {
-        ns = StyleContext.getDefaultStyleContext().new NamedStyle("styleName",
-                                                                  null);
+        ns = StyleContext.getDefaultStyleContext().new NamedStyle("styleName", null);
         assertNull(ns.getResolveParent());
         assertEquals("styleName", ns.getName());
     }
@@ -112,8 +109,7 @@
     }
 
     public void testSetNameNull() {
-        ns = StyleContext.getDefaultStyleContext().new NamedStyle("styleName",
-                null);
+        ns = StyleContext.getDefaultStyleContext().new NamedStyle("styleName", null);
         ns.setName(null);
         assertEquals("styleName", ns.getName());
     }
@@ -134,55 +130,42 @@
 
     public void testGetNameSetAttribute() {
         assertEquals("styleName", withName.getName());
-        assertEquals("styleName",
-                     withName.getAttribute(AttributeSet.NameAttribute));
-
+        assertEquals("styleName", withName.getAttribute(AttributeSet.NameAttribute));
         // Add name attribute
-        withName.addAttribute(AttributeSet.NameAttribute,
-                              new String("Changed Name"));
+        withName.addAttribute(AttributeSet.NameAttribute, new String("Changed Name"));
         assertEquals("Changed Name", withName.getName());
-        assertEquals("Changed Name",
-                     withName.getAttribute(AttributeSet.NameAttribute));
+        assertEquals("Changed Name", withName.getAttribute(AttributeSet.NameAttribute));
     }
 
     public void testContainsNameAttribute() {
         SimpleAttributeSet as = new SimpleAttributeSet();
         as.addAttribute(AttributeSet.NameAttribute, "styleName");
-
-        assertTrue(withName.containsAttribute(AttributeSet.NameAttribute,
-                                              "styleName"));
+        assertTrue(withName.containsAttribute(AttributeSet.NameAttribute, "styleName"));
         assertTrue(withName.containsAttributes(as));
     }
 
     public void testNameNotString() {
         ns = StyleContext.getDefaultStyleContext().new NamedStyle();
-
         ns.addAttribute(AttributeSet.NameAttribute, new Integer(15));
-
-        assertEquals(new Integer(15),
-                ns.getAttribute(AttributeSet.NameAttribute));
+        assertEquals(new Integer(15), ns.getAttribute(AttributeSet.NameAttribute));
         assertEquals((new Integer(15)).toString(), ns.getName());
     }
 
     public void testRemoveNameAttribute() {
         withName.removeAttribute(AttributeSet.NameAttribute);
-
         assertNull(withName.getName());
     }
 
     public void testGetAttrNames() {
         withName.addAttribute("key", "value");
-
-        boolean wasKey  = false;
+        boolean wasKey = false;
         boolean wasName = false;
-        Enumeration keys = withName.getAttributeNames();
+        Enumeration<?> keys = withName.getAttributeNames();
         while (keys.hasMoreElements()) {
             Object key = keys.nextElement();
-
-            wasKey  = wasKey  || key.equals("key");
+            wasKey = wasKey || key.equals("key");
             wasName = wasName || key.equals(AttributeSet.NameAttribute);
         }
-
         assertTrue(wasKey);
         assertTrue(wasName);
     }
@@ -196,10 +179,8 @@
         EventListener[] listeners = ns.getListeners(ChangeListener.class);
         assertEquals(1, listeners.length);
         assertSame(this, listeners[0]);
-
         listeners = ns.getListeners(CaretListener.class);
         assertEquals(0, listeners.length);
-
         ns.removeChangeListener(this);
         listeners = ns.getListeners(ChangeListener.class);
         assertEquals(0, listeners.length);
@@ -208,12 +189,10 @@
     public void testGetChangeListeners() {
         ChangeListener[] listeners = ns.getChangeListeners();
         assertEquals(0, listeners.length);
-
         ns.addChangeListener(this);
         listeners = ns.getChangeListeners();
         assertEquals(1, listeners.length);
         assertSame(this, listeners[0]);
-
         ns.removeChangeListener(this);
         listeners = ns.getChangeListeners();
         assertEquals(0, listeners.length);
@@ -224,15 +203,14 @@
         assertNotNull(ns.toString());
         assertTrue(str.startsWith("NamedStyle:null {"));
         String[] attrs = str.substring(17, str.length() - 1).split(",");
-        String[] expected = {"key1=value1", "key2=value2", "key3=value3"};
-        boolean[] found = {false, false, false};
+        String[] expected = { "key1=value1", "key2=value2", "key3=value3" };
+        boolean[] found = { false, false, false };
         assertEquals(expected.length, attrs.length);
         for (int i = 0; i < expected.length; i++) {
             for (int j = 0; j < attrs.length && !found[i]; j++) {
                 found[i] = found[i] || expected[i].equals(attrs[j]);
             }
         }
-
         for (int i = 0; i < found.length; i++) {
             if (!found[i]) {
                 fail(expected[i] + " was not found");
@@ -245,7 +223,6 @@
         bStateChanged = false;
         ns.fireStateChanged();
         assertTrue(bStateChanged);
-
         ns.removeChangeListener(this);
         bStateChanged = false;
         ns.fireStateChanged();
@@ -254,21 +231,17 @@
 
     public void testChangeEvent() {
         assertNull(ns.changeEvent);
-
         ns.fireStateChanged();
         assertNull(ns.changeEvent);
-
         ns.addChangeListener(this);
         assertNull(ns.changeEvent);
-
         ns.fireStateChanged();
         assertEquals(ns, ns.changeEvent.getSource());
     }
 
     public void testSerializable() throws Exception {
         ns.setName("styleName");
-
-        NamedStyle read = (NamedStyle)BasicSwingTestCase.serializeObject(ns);
+        NamedStyle read = (NamedStyle) BasicSwingTestCase.serializeObject(ns);
         assertTrue(ns.isEqual(read));
     }
 
@@ -301,16 +274,14 @@
     public void testCopyAttributesWithName() {
         StyleContext def = new StyleContext();
         Style parent = def.addStyle("parentStyle", null);
-        Style style  = def.addStyle("aStyle", parent);
-
+        Style style = def.addStyle("aStyle", parent);
         // Copy parent
-        Style copyParent = (Style)parent.copyAttributes();
+        Style copyParent = (Style) parent.copyAttributes();
         assertTrue(copyParent instanceof StyleContext.NamedStyle);
         assertEquals("parentStyle", copyParent.getName());
         assertNull(copyParent.getResolveParent());
-
         // Copy style
-        Style copyStyle = (Style)style.copyAttributes();
+        Style copyStyle = (Style) style.copyAttributes();
         assertTrue(copyStyle instanceof StyleContext.NamedStyle);
         assertEquals("aStyle", copyStyle.getName());
         assertSame(parent, copyStyle.getResolveParent());

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleContext_PredefinedAttrTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleContext_PredefinedAttrTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleContext_PredefinedAttrTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleContext_PredefinedAttrTest.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$
@@ -23,7 +22,6 @@
 
 import java.awt.Color;
 import java.awt.Font;
-
 import junit.framework.TestCase;
 
 /**
@@ -39,18 +37,13 @@
     public void testGetBackground() {
         Color color = sc.getBackground(sc.getEmptySet());
         assertSame(Color.black, color);
-
         Color colorAttrValue = new Color(0xFAF0E6);
-        AttributeSet as = sc.addAttribute(sc.getEmptySet(),
-                                          StyleConstants.Background,
-                                          colorAttrValue);
+        AttributeSet as = sc.addAttribute(sc.getEmptySet(), StyleConstants.Background,
+                colorAttrValue);
         color = sc.getBackground(as);
         assertSame(colorAttrValue, color);
-
         Color newAttrValue = new Color(0xFAF0E6);
-        as = sc.addAttribute(as, StyleConstants.Background,
-                             newAttrValue);
-
+        as = sc.addAttribute(as, StyleConstants.Background, newAttrValue);
         color = sc.getBackground(as);
         assertSame(colorAttrValue, color);
         assertNotSame(colorAttrValue, newAttrValue);
@@ -63,22 +56,17 @@
         Font fontEmpty = sc.getFont(sc.getEmptySet());
         Font fontEmpty2 = sc.getFont(sc.getEmptySet());
         assertSame(fontEmpty, fontEmpty2);
-
-        AttributeSet as = sc.addAttribute(sc.getEmptySet(),
-                                          StyleConstants.FontFamily,
-                                          FONT_FAMILY);
+        AttributeSet as = sc.addAttribute(sc.getEmptySet(), StyleConstants.FontFamily,
+                FONT_FAMILY);
         Font fontArial = sc.getFont(as);
         assertEquals(FONT_FAMILY, fontArial.getName());
         assertFalse(fontArial.getName().equals(fontEmpty.getName()));
         assertNotSame(fontEmpty, fontArial);
-
         as = sc.addAttribute(as, StyleConstants.FontSize, new Integer(12));
         Font fontSize = sc.getFont(as);
         assertSame(fontArial, fontSize); // As default font size is 12
-
         as = sc.addAttribute(as, StyleConstants.Bold, Boolean.FALSE);
         assertSame(fontSize, sc.getFont(as));
-
         as = sc.addAttribute(as, StyleConstants.Bold, Boolean.TRUE);
         Font fontBold = sc.getFont(as);
         assertNotSame(fontSize, fontBold);
@@ -99,7 +87,6 @@
         assertSame(one, two);
         assertTrue(one.isPlain());
         assertEquals(12, one.getSize());
-
         one = sc.getFont(FONT_FAMILY, Font.BOLD | Font.ITALIC, 12);
         two = sc.getFont(FONT_FAMILY, Font.BOLD | Font.ITALIC, 12);
         assertSame(one, two);
@@ -110,23 +97,19 @@
     public void testGetForeground() {
         Color color = sc.getForeground(sc.getEmptySet());
         assertSame(Color.black, color);
-
         Color colorAttrValue = new Color(0xFFE4E1);
-        AttributeSet as = sc.addAttribute(sc.getEmptySet(),
-                                          StyleConstants.Foreground,
-                                          colorAttrValue);
+        AttributeSet as = sc.addAttribute(sc.getEmptySet(), StyleConstants.Foreground,
+                colorAttrValue);
         color = sc.getForeground(as);
         assertSame(colorAttrValue, color);
-
         Color newAttrValue = new Color(0xFFE4E1);
-        as = sc.addAttribute(as, StyleConstants.Foreground,
-                             newAttrValue);
-
+        as = sc.addAttribute(as, StyleConstants.Foreground, newAttrValue);
         color = sc.getForeground(as);
         assertSame(colorAttrValue, color);
         assertNotSame(colorAttrValue, newAttrValue);
     }
 
+    @Override
     protected void setUp() throws Exception {
         sc = StyleContextTest.sc = new StyleContext();
     }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleContext_RemoveTests.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleContext_RemoveTests.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleContext_RemoveTests.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/StyleContext_RemoveTests.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$
@@ -22,10 +21,8 @@
 package javax.swing.text;
 
 import java.util.Enumeration;
-
 import javax.swing.BasicSwingTestCase;
 import javax.swing.text.StyleContext.SmallAttributeSet;
-
 import junit.framework.TestCase;
 
 /**
@@ -38,8 +35,10 @@
      * Class supporting testing of removeAttributes(Enumeration) method
      * of StyleContext.
      */
+    @SuppressWarnings("unchecked")
     private class AttributeNameEnumeration implements Enumeration {
         private int count;
+
         private int index;
 
         /**
@@ -82,7 +81,6 @@
     public void testRemoveAttribute() {
         AttributeSet as = StyleContextTest.addAttribute(5);
         as = sc.removeAttribute(as, StyleContextTest.attr[2]);
-
         assertEquals(4, as.getAttributeCount());
     }
 
@@ -92,12 +90,8 @@
     public void testRemoveAttributeCache() {
         AttributeSet as = StyleContextTest.addAttribute(4);
         SimpleAttributeSet sas = new SimpleAttributeSet(as);
-        sas.addAttribute(StyleContextTest.attr[5 * 2],
-                         StyleContextTest.attr[5 * 2 + 1]);
-
-        AttributeSet test = sc.removeAttribute(sas,
-                                               StyleContextTest.attr[5 * 2]);
-
+        sas.addAttribute(StyleContextTest.attr[5 * 2], StyleContextTest.attr[5 * 2 + 1]);
+        AttributeSet test = sc.removeAttribute(sas, StyleContextTest.attr[5 * 2]);
         assertEquals(4, test.getAttributeCount());
         assertSame(as, test);
     }
@@ -109,11 +103,8 @@
      */
     public void testRemoveAttributeCollapse() {
         AttributeSet as = StyleContextTest.addAttribute(10);
-
         assertTrue(as instanceof SimpleAttributeSet);
-
         as = sc.removeAttribute(as, StyleContextTest.attr[0]);
-
         assertEquals(9, as.getAttributeCount());
         assertTrue(as instanceof SmallAttributeSet);
     }
@@ -124,7 +115,6 @@
     public void testRemoveAttributeFromOne() {
         AttributeSet as = StyleContextTest.addAttribute(1);
         as = sc.removeAttribute(as, StyleContextTest.attr[0]);
-
         assertEquals(0, as.getAttributeCount());
         if (!BasicSwingTestCase.isHarmony()) {
             assertTrue(as instanceof SmallAttributeSet);
@@ -141,23 +131,17 @@
     public void testRemoveAttributeNoCache() {
         SimpleAttributeSet sas = new SimpleAttributeSet();
         for (int i = 0; i < 6; i += 2) {
-            sas.addAttribute(StyleContextTest.attr[i],
-                             StyleContextTest.attr[i + 1]);
+            sas.addAttribute(StyleContextTest.attr[i], StyleContextTest.attr[i + 1]);
         }
-
         AttributeSet test = sc.removeAttribute(sas, StyleContextTest.attr[4]);
-
         // Create the same set as test
         AttributeSet as = StyleContextTest.addAttribute(2);
-
         assertSame(test, as);
     }
 
     public void testRemoveAttributeNoKey() {
         AttributeSet as = StyleContextTest.addAttribute(2);
-
         AttributeSet test = sc.removeAttribute(as, StyleContextTest.attr[4]);
-
         assertSame(as, test);
     }
 
@@ -168,10 +152,7 @@
     public void testRemoveAttributesEnumCache() {
         AttributeSet cached = StyleContextTest.addAttribute(1);
         AttributeSet as = StyleContextTest.addAttribute(cached, 1, 2);
-
-        AttributeSet test =
-            sc.removeAttributes(as, new AttributeNameEnumeration(1, 2));
-
+        AttributeSet test = sc.removeAttributes(as, new AttributeNameEnumeration(1, 2));
         assertEquals(1, test.getAttributeCount());
         assertSame(cached, test);
     }
@@ -182,10 +163,7 @@
      */
     public void testRemoveAttributesEnumEmpty() {
         AttributeSet as = StyleContextTest.addAttribute(3);
-
-        AttributeSet test =
-            sc.removeAttributes(as, new AttributeNameEnumeration(3));
-
+        AttributeSet test = sc.removeAttributes(as, new AttributeNameEnumeration(3));
         assertEquals(0, test.getAttributeCount());
         if (BasicSwingTestCase.isHarmony()) {
             assertSame(test, sc.getEmptySet());
@@ -198,16 +176,11 @@
      */
     public void testRemoveAttributesEnumNoCache() {
         AttributeSet as = StyleContextTest.addAttribute(4);
-
-        AttributeSet test =
-            sc.removeAttributes(as, new AttributeNameEnumeration(1, 2));
-
+        AttributeSet test = sc.removeAttributes(as, new AttributeNameEnumeration(1, 2));
         assertEquals(2, test.getAttributeCount());
-
         // Create the same set as test
         AttributeSet cached = StyleContextTest.addAttribute(1);
         cached = StyleContextTest.addAttribute(cached, 3, 1);
-
         assertSame(test, cached);
     }
 
@@ -218,12 +191,8 @@
     public void testRemoveAttributesEnumNoKey() {
         AttributeSet as = StyleContextTest.addAttribute(2);
         as = StyleContextTest.addAttribute(as, 4, 2);
-
         assertEquals(4, as.getAttributeCount());
-
-        AttributeSet test =
-            sc.removeAttributes(as, new AttributeNameEnumeration(1, 4));
-
+        AttributeSet test = sc.removeAttributes(as, new AttributeNameEnumeration(1, 4));
         assertEquals(2, test.getAttributeCount());
     }
 
@@ -233,13 +202,9 @@
      */
     public void testRemoveAttributesEnumSmall() {
         AttributeSet as = StyleContextTest.addAttribute(10);
-
         assertTrue(as instanceof SimpleAttributeSet);
-
         // Remove one element
-        AttributeSet test =
-            sc.removeAttributes(as, new AttributeNameEnumeration(1));
-
+        AttributeSet test = sc.removeAttributes(as, new AttributeNameEnumeration(1));
         assertEquals(9, test.getAttributeCount());
         if (BasicSwingTestCase.isHarmony()) {
             assertTrue(test instanceof SmallAttributeSet);
@@ -253,10 +218,7 @@
     public void testRemoveAttributesSetCache() {
         AttributeSet cached = StyleContextTest.addAttribute(1);
         AttributeSet as = StyleContextTest.addAttribute(cached, 1, 2);
-
-        AttributeSet test =
-            sc.removeAttributes(as, StyleContextTest.addAttribute(null, 1, 2));
-
+        AttributeSet test = sc.removeAttributes(as, StyleContextTest.addAttribute(null, 1, 2));
         assertEquals(1, test.getAttributeCount());
         assertSame(cached, test);
     }
@@ -269,11 +231,8 @@
     public void testRemoveAttributesSetCacheSameKeys() {
         AttributeSet cached = StyleContextTest.addAttribute(2);
         AttributeSet as = StyleContextTest.addAttribute(cached, 2, 3);
-
-        AttributeSet test = sc.removeAttributes(as,
-                sc.addAttribute(StyleContextTest.addAttribute(null, 1, 4),
-                                StyleConstants.Italic, Boolean.FALSE));
-
+        AttributeSet test = sc.removeAttributes(as, sc.addAttribute(StyleContextTest
+                .addAttribute(null, 1, 4), StyleConstants.Italic, Boolean.FALSE));
         assertEquals(2, test.getAttributeCount());
         assertSame(cached, test);
     }
@@ -285,9 +244,7 @@
      */
     public void testRemoveAttributesSetEmpty() {
         AttributeSet as = StyleContextTest.addAttribute(3);
-
         AttributeSet test = sc.removeAttributes(as, as);
-
         assertEquals(0, test.getAttributeCount());
         if (BasicSwingTestCase.isHarmony()) {
             assertSame(test, sc.getEmptySet());
@@ -301,11 +258,8 @@
      */
     public void testRemoveAttributesSetEmptySameKey() {
         AttributeSet as = StyleContextTest.addAttribute(3);
-
-        AttributeSet test =
-            sc.removeAttributes(as, sc.addAttribute(as, StyleConstants.Bold,
-                                                    Boolean.FALSE));
-
+        AttributeSet test = sc.removeAttributes(as, sc.addAttribute(as, StyleConstants.Bold,
+                Boolean.FALSE));
         assertEquals(1, test.getAttributeCount());
     }
 
@@ -316,17 +270,12 @@
      */
     public void testRemoveAttributesSetNoCacheSameKeys() {
         AttributeSet as = StyleContextTest.addAttribute(4);
-
-        AttributeSet test = sc.removeAttributes(as,
-                sc.addAttribute(StyleContextTest.addAttribute(null, 1, 2),
-                                StyleConstants.Underline, Boolean.FALSE));
-
+        AttributeSet test = sc.removeAttributes(as, sc.addAttribute(StyleContextTest
+                .addAttribute(null, 1, 2), StyleConstants.Underline, Boolean.FALSE));
         assertEquals(3, test.getAttributeCount());
-
         // Create the same set as test
         AttributeSet cached = StyleContextTest.addAttribute(1);
         cached = StyleContextTest.addAttribute(cached, 2, 2);
-
         assertSame(test, cached);
     }
 
@@ -338,12 +287,8 @@
     public void testRemoveAttributesSetNoKey() {
         AttributeSet as = StyleContextTest.addAttribute(2);
         as = StyleContextTest.addAttribute(as, 4, 2);
-
         assertEquals(4, as.getAttributeCount());
-
-        AttributeSet test =
-            sc.removeAttributes(as, StyleContextTest.addAttribute(null, 1, 4));
-
+        AttributeSet test = sc.removeAttributes(as, StyleContextTest.addAttribute(null, 1, 4));
         assertEquals(2, test.getAttributeCount());
     }
 
@@ -353,19 +298,16 @@
      */
     public void testRemoveAttributesSetSmall() {
         AttributeSet as = StyleContextTest.addAttribute(10);
-
         assertTrue(as instanceof SimpleAttributeSet);
-
         // Remove one element
-        AttributeSet test =
-            sc.removeAttributes(as, StyleContextTest.addAttribute(1));
-
+        AttributeSet test = sc.removeAttributes(as, StyleContextTest.addAttribute(1));
         assertEquals(9, test.getAttributeCount());
         if (BasicSwingTestCase.isHarmony()) {
             assertTrue(test instanceof SmallAttributeSet);
         }
     }
 
+    @Override
     protected void setUp() throws Exception {
         sc = StyleContextTest.sc = new StyleContext();
     }



Mime
View raw message