harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r454289 [21/22] - in /incubator/harmony/enhanced/classlib/trunk/modules/H-1609: ./ modules/ modules/applet/ modules/applet/src/ modules/applet/src/main/ modules/applet/src/main/java/ modules/applet/src/main/java/java/ modules/applet/src/mai...
Date Mon, 09 Oct 2006 05:33:21 GMT
Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/HashAttributeTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/HashAttributeTest.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/HashAttributeTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/HashAttributeTest.java Sun Oct  8 22:33:09 2006
@@ -0,0 +1,444 @@
+/*
+ *  Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+/** 
+ * @author Elena V. Sayapina 
+ * @version $Revision: 1.3 $ 
+ */ 
+
+package javax.print.attribute;
+
+
+import javax.print.PrintService;
+import javax.print.PrintServiceLookup;
+import javax.print.SimpleDoc;
+import javax.print.attribute.standard.*;
+
+import junit.framework.TestCase;
+
+public class HashAttributeTest extends TestCase {
+
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(HashAttributeTest.class);
+    }
+
+    static {
+        System.out.println("HashAttribute testing...");
+    }
+
+    private HashAttributeSet aset;
+
+
+    /*
+     * HashAttributeSet() constructors testing. 
+     */
+    public final void testHashAttributeSetConstructors() {
+
+        try {
+            Attribute att = null;
+            AttributeSet aset = new HashAttributeSet(att);
+            fail("HashAttributeSet(Attribute attribute) " +
+                    "doesn't throw NullPointerException " +
+                    "if attribute is null");
+        } catch (NullPointerException e) {}
+
+        try {
+            Attribute att = null;
+            Attribute attrs[] = {att};
+            AttributeSet aset = new HashAttributeSet(attrs);
+            fail("HashAttributeSet(Attribute[] attributes) " +
+                    "doesn't throw NullPointerException " +
+                    "if attributes is null");
+        } catch (NullPointerException e) {}
+
+        try {
+            AttributeSet aset1 = null;
+            AttributeSet aset2 = new HashAttributeSet(aset1);
+        } catch (Exception e) {
+            fail("Unexpected exception occurred: " + e.toString());
+        }
+    }
+
+
+    /*
+     * add(Attribute attribute) method testing. Tests that after adding 
+     * some attribute to specified attribute set this attribute is in 
+     * this attribute set.
+     */
+    public final void testAdd() {
+
+        aset = new HashAttributeSet();
+        Attribute att1 = PrintQuality.HIGH;
+        boolean flag = aset.add(att1);
+
+        Attribute att2 = aset.get(PrintQuality.class);
+
+        if (flag){
+            assertTrue("Results add() & get() is different: att1 = "
+                            +att1+", att2 = "+att2,
+                                        att1 == att2 );
+            assertTrue("Attribute set doesn't contain added attribute value",
+                            aset.containsValue(PrintQuality.HIGH) == true );
+        }else{
+            fail("add() == false");
+        }
+
+    }
+
+
+    /*
+     * add(Attribute attribute) method testing. Tests if add some attribute 
+     * that is already in current attributeSet than add() returns false.
+     */
+    public final void testAdd1() {
+
+        aset = new HashAttributeSet();
+
+        Attribute att = new Copies(10);
+        aset.add(att);
+        assertTrue(aset.add(att) == false);
+
+        att = Sides.DUPLEX;
+        aset.add(att);
+        assertTrue(aset.add(att) == false);
+
+    }
+
+    /*
+     * add(Attribute attribute) method testing. 
+     * Tests that if this attribute set does not support the add() operation
+     * UnmodifiableSetException is thrown.
+     */
+    public final void testAdd2() {
+
+        PrintService service = PrintServiceLookup.lookupDefaultPrintService();
+        if (service != null) {
+            PrintServiceAttributeSet psaset = service.getAttributes();
+            try{
+                psaset.add(ColorSupported.NOT_SUPPORTED);
+                fail("add() doesn't throw Exception when" +
+                    "trying to add attribute to unmodifiable attribute set ");
+            } catch (UnmodifiableSetException e){
+            }
+        } else {
+            System.out.println("Warning: default print service wasn't found!" +
+                    "\nPlease check if you have any printers connected to your"
+                    + " computer");
+        }
+
+        aset = new HashAttributeSet();
+        AttributeSet as = AttributeSetUtilities.unmodifiableView(aset);
+        try{
+            as.add(new Copies(3));
+            fail("add() doesn't throw Exception when" +
+                    "trying to add attribute to unmodifiable attribute set ");
+        } catch (UnmodifiableSetException e) {
+        }
+    }
+
+
+    /*
+     * addAll(AttributeSet attributeSet) method testing.
+     */
+    public final void testAddAll() {
+
+        HashAttributeSet aset1 = new HashAttributeSet(new Attribute[]
+                                                              {new Copies(10),
+                                                               Sides.DUPLEX} );
+        HashAttributeSet aset2 = new HashAttributeSet();
+        aset2.addAll(aset1);
+        assertTrue(aset2.equals(aset1));
+    }
+
+    /*
+     * addAll(AttributeSet attributeSet) method testing. Test that addAll()  
+     * throws NullPointerException if attributeSet is null.
+     */
+    public final void testAddAll1() {
+
+        HashAttributeSet aset1 = new HashAttributeSet();
+        HashAttributeSet aset2 = null;
+        try {
+            aset.addAll(aset2);
+            fail("addAll() doesn't throw NullPointerException when" +
+                    "trying to add null attribute set");
+        } catch (NullPointerException e) {
+
+        }
+    }
+
+    /*
+     * addAll(AttributeSet attributeSet) method testing. 
+     * 
+     */
+    public final void testAddAll2() {
+
+        HashPrintServiceAttributeSet aset1 = new HashPrintServiceAttributeSet();
+        HashAttributeSet aset2 = new HashAttributeSet();
+        aset2.add(new JobName("jobName", null));
+        try {
+            aset1.addAll(aset2);
+            fail("addAll() doesn't throw ClassCastException" +
+                    "when specification req");
+        } catch (ClassCastException e) {
+
+        }
+    }
+
+    /*
+     * clear() method testing. 
+     * Test that clear() remove all values from this attribite set.
+     */
+    public final void testClear() {
+
+        aset = new HashAttributeSet();
+        aset.add(SheetCollate.COLLATED);
+        if (aset.get(SheetCollate.class) != null) {
+            aset.clear();
+            assertEquals(null, aset.get(SheetCollate.class));
+        } else {
+            fail("add() or get() works wrong");
+        }
+
+        aset.add(SheetCollate.COLLATED);
+        aset.add(ColorSupported.SUPPORTED);
+        if ( !aset.isEmpty() ) {
+            aset.clear();
+            assertEquals(null, aset.get(SheetCollate.class));
+            assertEquals(null, aset.get(ColorSupported.class));
+        } else {
+            fail("add() or isEmpty() works wrong");
+        }
+
+    }
+
+
+    /*
+     * containsKey(class attributeCategory) method testing. Tests if current
+     * attribute set contains value for given attribute category than 
+     * containsKey() returns true.
+     */
+    public final void testContainsKey() {
+
+        aset = new HashAttributeSet();
+        aset.add(SheetCollate.COLLATED);
+        assertTrue(aset.containsKey(SheetCollate.class));
+    }
+
+
+    /*
+     * containsKey(Attribute attribute) method testing. Tests if current
+     * attribute set don't contain value for given attribute category than
+     * containsKey() returns false.
+     */
+    public final void testContainsKey1() {
+
+        aset = new HashAttributeSet();
+        assertFalse(aset.containsKey(SheetCollate.class));
+    }
+
+
+    /*
+     * containsValue(Attribute attribute) method testing. Tests if current
+     * attribute set doesn't contain value for given attribute for it's 
+     * attribute than containsKey() returns false.
+     */
+    public final void testContainsValue() {
+
+        aset = new HashAttributeSet();
+        aset.add(SheetCollate.UNCOLLATED);
+        assertFalse(aset.containsValue(SheetCollate.COLLATED));
+    }
+
+    /*
+     * containsValue(Attribute attribute) method testing. Test if input 
+     * parameter is null than containsValue() returns false.
+     */
+    public final void testContainsValue1() {
+
+        aset = new HashAttributeSet();
+        assertFalse(aset.containsValue(null));
+    }
+
+
+    /*
+     * equals(Object object) method testing.
+     */
+    public final void testEquals() {
+
+        aset = new HashAttributeSet();
+        PrintService service = PrintServiceLookup.lookupDefaultPrintService();
+        if (service != null) {
+            PrintServiceAttributeSet psaset = service.getAttributes();
+            if (aset.addAll(psaset)){
+                assertTrue(aset.equals(psaset));
+            }
+        } else {
+            System.out.println("Warning: default print service wasn't found!\n"
+                    + "Please check if you have any printers connected to your "
+                    + "computer.");
+        }
+
+        JobPriority priority = new JobPriority(2);
+        PrintRequestAttributeSet set1 = new HashPrintRequestAttributeSet();
+        set1.add(priority);
+        set1.add(MediaName.ISO_A4_TRANSPARENT);
+        PrintRequestAttribute[] arr = { priority, MediaName.ISO_A4_TRANSPARENT };
+        PrintRequestAttributeSet set2 = new HashPrintRequestAttributeSet(arr);
+        assertTrue(set2.equals(set1));
+
+        HashPrintRequestAttributeSet paset1 = new HashPrintRequestAttributeSet(
+                new PrintRequestAttribute[] {new Copies(3),
+                        new JobName("JobName", null), MediaSizeName.A});
+        HashPrintRequestAttributeSet paset2 = new HashPrintRequestAttributeSet();
+        paset2.add(new JobName("JobName", null));
+        paset2.add(MediaSizeName.A);
+        assertFalse(paset1.equals(paset2));
+        paset2.add( new Copies(3));
+        assertTrue(paset1.equals(paset2));
+
+        aset = new HashAttributeSet();
+        HashAttributeSet nullAset = null;
+        assertFalse(aset.equals(nullAset));
+    }
+
+    /*
+     * equals(Object object) method testing. Tests if given object is not
+     * an attribute set equals() return false.
+     */
+    public final void testEquals1() {
+
+        aset = new HashAttributeSet();
+        Attribute att = new Copies(1);
+        assertFalse("equals return true when given object is " +
+                    "not an attribute set", aset.equals(att));
+    }
+
+    /*
+     * get(Class attributeCategory) method testing. Tests if given object is not
+     * a class that implements interface Attribute than get() throw 
+     * ClassCastException.
+     */
+    public final void testGet1() {
+
+        aset = new HashAttributeSet();
+        try {
+            aset.get(SimpleDoc.class);
+            fail("get() doesn't throw ClassCastException when given object" +
+                    "is not a Class that implements interface Attribute");
+        } catch (ClassCastException e) {
+
+        }
+    }
+
+    /*
+     * hashCode() method testing. Tests if two object is the same they must have
+     * same hashCode.
+     */
+    public final void testHashCode() {
+
+        HashAttributeSet aset1 = new HashAttributeSet();
+        aset1.add(new Copies(5));
+        HashAttributeSet aset2 = new HashAttributeSet();
+        aset2.add(new Copies(5));
+        assertEquals("Two equals object have different hash codes",
+                        aset1.hashCode(), aset2.hashCode());
+    }
+
+    /*
+     * isEmpty() method testing. Tests if given attribute set is empty 
+     * than isempty return true.
+     */
+    public final void testIsEmpty() {
+
+        aset = new HashAttributeSet();
+        assertTrue(aset.isEmpty());
+    }
+
+    /*
+     * isEmpty() method testing. Tests if given attribute set isn't empty 
+     * than isempty return false.
+     */
+    public final void testIsEmpty1() {
+
+        aset = new HashAttributeSet();
+        aset.add(new Copies(2));
+        assertFalse(aset.isEmpty());
+    }
+
+    /*
+     * remove(Attribute attribute) method testing. Tests that if given attribute
+     * wasn't in attribute set than remove(Attribute attribut) returns false.
+     */
+    public final void testRemove() {
+
+        aset = new HashAttributeSet();
+        aset.add(new Copies(2));
+        assertFalse(aset.remove(Sides.DUPLEX));
+    }
+
+
+    /*
+     * remove(Class attributeCategory) method testing. 
+     * Tests that remove(Class attributeCategory)
+     * is really remove attribute for given attribute category.
+     */
+    public final void testRemove1() {
+
+        aset = new HashAttributeSet();
+        aset.add(Sides.DUPLEX);
+        assertTrue(aset.remove(Sides.class));
+        assertNull(aset.get(Sides.class));
+    }
+
+    /*
+     * size() method testing. Tests that size return right values
+     * when attribute set contains no or one attribute value.
+     */
+    public final void testSize() {
+
+        aset = new HashAttributeSet();
+        assertEquals("size() return not 0 for the empty attribute set",
+                                0, aset.size());
+        aset.add(new Copies(5));
+        assertEquals(1, aset.size());
+    }
+
+
+    /*
+     * toArray() method testing. Tests that toArray() returns 
+     * array of attribute with right attribute value.
+     */
+    public final void testToArray() {
+
+        aset = new HashAttributeSet();
+        aset.add(PrintQuality.HIGH);
+        Attribute[] arr = aset.toArray();
+        assertEquals(PrintQuality.HIGH, arr[0]);
+    }
+
+    /*
+     * toArray() method testing. Tests if given attribute set is empty toArray() 
+     * returns zero length array.
+     */
+    public final void testToArray1() {
+
+        aset = new HashAttributeSet();
+        assertEquals(0, (aset.toArray()).length);
+    }
+
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/HashAttributeTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/IntegerSyntaxTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/IntegerSyntaxTest.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/IntegerSyntaxTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/IntegerSyntaxTest.java Sun Oct  8 22:33:09 2006
@@ -0,0 +1,157 @@
+/*
+ *  Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+/** 
+ * @author Elena V. Sayapina 
+ * @version $Revision: 1.3 $ 
+ */ 
+
+package javax.print.attribute;
+
+import javax.print.attribute.standard.Copies;
+import javax.print.attribute.standard.NumberUp;
+import javax.print.attribute.standard.PagesPerMinute;
+
+import junit.framework.TestCase;
+
+public class IntegerSyntaxTest extends TestCase {
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(IntegerSyntaxTest.class);
+    }
+
+
+    static {
+        System.out.println("IntegerSyntax testing...");
+    }
+
+
+    IntegerSyntax is1, is2;
+
+
+    /*
+     * IntegerSyntax(int value) constructor testing. 
+     */
+    public final void testIntegerSyntax_Int() {
+        is1 = new integerSyntax(300);
+        assertEquals(300, is1.getValue());
+    }
+
+    /*
+     * IntegerSyntax(int value, int lowerBound, int upperBound) constructor testing. 
+     */
+    public final void testIntegerSyntax_IntIntInt() {
+        try {
+            is1 = new integerSyntax(-1, 1, 1);
+            fail("Constructor IntegerSyntax(int value, int lowerBound, int upperBound) " +
+                    "doesn't throw IllegalArgumentException " +
+                    "if value is less than lowerBound");
+        } catch (IllegalArgumentException e) {
+
+        }
+
+        try {
+            is1 = new integerSyntax(2, 1, 1);
+            fail("Constructor IntegerSyntax(int value, int lowerBound, int upperBound) " +
+                    "doesn't throw IllegalArgumentException " +
+                    "if value is greater than upperBound");
+        } catch (IllegalArgumentException e) {
+
+        }
+
+        is1 = new integerSyntax(300, 1, 400);
+        assertEquals(300, is1.getValue());
+    }
+
+    /*
+     * hashCode() method testing. Tests if two object aren't equal they should
+     * have different hash codes.
+     */
+    public final void testHashCode() {
+        is1 = new integerSyntax(1000);
+        is2 = new integerSyntax(1000-1);
+        assertTrue(is2.hashCode() == 999);
+        assertTrue(is1.hashCode() != is2.hashCode());
+    }
+
+    /*
+     * hashCode() method testing. Tests if two object are equal they must have
+     * the same hash code.
+     */
+    public final void testHashCode1() {
+        is1 = new integerSyntax(1, 1, 10);
+        is2 = new integerSyntax(1, 1, 15);
+        assertTrue(is1.hashCode() == 1);
+        assertTrue(is1.hashCode() == is2.hashCode());
+    }
+
+    /*
+     * hashCode() method testing. Tests that hash code is just this integer 
+     * attribute's integer value.
+     */
+    public final void testHashCode2() {
+        is1 = new Copies(5);
+        is2 = new NumberUp(5);
+        assertTrue(is1.hashCode() == 5);
+        assertTrue(is2.hashCode() == 5);
+        assertTrue(is1.hashCode() == is2.hashCode());
+    }
+
+    /*
+     * equals(Object object) method testing. Tests if two IntegerSyntax 
+     * objects are equal equals() return true.
+     */
+    public final void testEquals() {
+        is1 = new Copies(99);
+        is2 = new Copies(99);
+        assertTrue(is1.equals(is2));
+    }
+
+    /*
+     * equals(Object object) method testing. Tests if two IntegerSyntax 
+     * objects aren't equal equals() return false.
+     */
+    public final void testEquals1() {
+        is1 = new Copies(99);
+        is2 = new NumberUp(99);
+        assertFalse(is1.equals(is2));
+
+        is2 = null;
+        assertFalse(is1.equals(is2));
+    }
+
+    /*
+     * getValue() method testing. 
+     */
+    public final void testGetValue() {
+        is1 = new PagesPerMinute(30);
+        assertTrue(is1.getValue() == 30);
+    }
+
+    /*
+     * Auxiliary class
+     */
+    protected class integerSyntax extends IntegerSyntax {
+
+        public  integerSyntax(int value) {
+            super(value);
+        }
+
+        public  integerSyntax(int value, int lowerBound, int upperBound) {
+            super(value, lowerBound, upperBound);
+        }
+    }
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/IntegerSyntaxTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/ResolutionSyntaxTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/ResolutionSyntaxTest.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/ResolutionSyntaxTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/ResolutionSyntaxTest.java Sun Oct  8 22:33:09 2006
@@ -0,0 +1,212 @@
+/*
+ *  Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+/** 
+ * @author Elena V. Sayapina 
+ * @version $Revision: 1.3 $ 
+ */ 
+
+package javax.print.attribute;
+
+import junit.framework.TestCase;
+
+
+public class ResolutionSyntaxTest extends TestCase {
+
+    static {
+        System.out.println("ResolutionSyntax testing...");
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(ResolutionSyntaxTest.class);
+    }
+
+    resolutionSyntax rs1, rs2;
+
+    /*
+     * ResolutionSyntax(int crossFeedResolution, int feedResolution, 
+     * int units) constructor testing. 
+     */
+    public final void testResolutionSyntax() {
+        try {
+            rs1 = new resolutionSyntax(1, 1, 0);
+            fail("ResolutionSyntax(int crossFeedResolution, " +
+                    "int feedResolution, int units) doesn't throw " +
+                    "IllegalArgumentException if units < 1");
+        } catch (IllegalArgumentException e) {}
+
+        try {
+            rs1 = new resolutionSyntax(-1, 1, 1);
+            fail("ResolutionSyntax(int crossFeedResolution, " +
+                    "int feedResolution, int units) doesn't throw " +
+                    "IllegalArgumentException if " +
+                    "crossFeedResolution < 1");
+        } catch (IllegalArgumentException e) {}
+        try {
+            rs1 = new resolutionSyntax(1, 0, 10);
+            fail("ResolutionSyntax(int crossFeedResolution, " +
+                    "int feedResolution, int units) doesn't throw " +
+                    "IllegalArgumentException if " +
+                    "or feedResolution < 1");
+        } catch (IllegalArgumentException e) {}
+
+        rs1 = new resolutionSyntax(10001, 1507, resolutionSyntax.DPI);
+        assertEquals(10001, rs1.getCrossFeedResolution(resolutionSyntax.DPI));
+        assertEquals(1507, rs1.getFeedResolution(resolutionSyntax.DPI));
+    }
+
+    /*
+     * hashCode() method testing. Tests if two object aren't equal they should
+     * have different hash codes.
+     */
+    public final void testHashCode() {
+        rs1 = new resolutionSyntax(4444, 333, resolutionSyntax.DPCM);
+        rs2 = new resolutionSyntax(333, 444, resolutionSyntax.DPCM);
+        assertTrue(rs1.hashCode() != rs2.hashCode());
+    }
+
+    /*
+     * hashCode() method testing. Tests if two object are equal they must have
+     * the same hash code.
+     */
+    public final void testHashCode1() {
+        rs1 = new resolutionSyntax(1, 1, resolutionSyntax.DPCM);
+        rs2 = new resolutionSyntax(1, 1, resolutionSyntax.DPCM);
+        assertTrue(rs1.hashCode() == rs2.hashCode());
+    }
+
+    /*
+     * equals(Object object) method testing. Tests if two object are equal 
+     * they must have the same hash code.
+     */
+    public final void testEqualsObject() {
+        rs1 = new resolutionSyntax(1, 1, resolutionSyntax.DPCM);
+        rs2 = new resolutionSyntax(1, 1, resolutionSyntax.DPCM);
+        assertTrue(rs1.equals(rs2));
+
+        rs1 = new resolutionSyntax(1, 1, resolutionSyntax.DPCM);
+        rs2 = new resolutionSyntax(1, 1, resolutionSyntax.DPI);
+        assertFalse(rs1.equals(rs2));
+
+        rs1 = new resolutionSyntax(1000, 2000, resolutionSyntax.DPCM);
+        rs2 = new resolutionSyntax(1000, 2000, resolutionSyntax.DPCM);
+        assertTrue(rs1.equals(rs2));
+
+        rs1 = new resolutionSyntax(1000, 2000, resolutionSyntax.DPI);
+        rs2 = new resolutionSyntax(1000, 2000-1, resolutionSyntax.DPCM);
+        assertFalse(rs1.equals(rs2));
+
+        rs2 = null;
+        assertFalse("equals(object o) returns true if o is null",
+                    rs1.equals(rs2));
+    }
+
+    public final void testGetCrossFeedResolution() {
+        rs1 = new resolutionSyntax(1000, 2000, 1);
+        assertEquals(1000, rs1.getCrossFeedResolution(1));
+        try {
+            rs1.getCrossFeedResolution(0);
+            fail("getCrossFeedResolution(int units) doesn't throw " +
+                    "IllegalArgumentException if units < 1");
+        } catch (IllegalArgumentException e) {}
+    }
+
+    public final void testGetCrossFeedResolutionDphi() {
+        rs1 = new resolutionSyntax(1000, 2000, 3);
+        assertEquals(3000, rs1.getCrossFeedResolutionDphiEx());
+        rs1 = new resolutionSyntax(1000, 2000, 1);
+        assertEquals("bad rounding", 333, rs1.getCrossFeedResolution(3));
+    }
+
+    public final void testGetFeedResolution() {
+        rs1 = new resolutionSyntax(1000, 2000, 1);
+        assertEquals(2000, rs1.getFeedResolution(1));
+        try {
+            rs1.getFeedResolution(-100);
+            fail("getFeedResolution(int units) doesn't throw " +
+                    "IllegalArgumentException if units < 1");
+        } catch (IllegalArgumentException e) {}
+    }
+
+    public final void testGetFeedResolutionDphi() {
+        rs1 = new resolutionSyntax(1000, 2000, 3);
+        assertEquals(6000, rs1.getFeedResolutionDphiEx());
+        rs1 = new resolutionSyntax(1000, 500, 1);
+        assertEquals("bad rounding", 63, rs1.getFeedResolution(8));
+    }
+
+    public final void testGetResolution() {
+        rs1 = new resolutionSyntax(1000, 2000, resolutionSyntax.DPCM);
+        assertEquals(1000, rs1.getResolution(resolutionSyntax.DPCM)[0]);
+        assertEquals(2000, rs1.getResolution(resolutionSyntax.DPCM)[1]);
+        try {
+            rs1.getResolution(0);
+            fail("getResolution(int units) doesn't throw " +
+                    "IllegalArgumentException if units < 1");
+        } catch (IllegalArgumentException e) {}
+    }
+
+
+    public final void testLessThanOrEquals() {
+        rs1 = new resolutionSyntax(1000, 1000, 1);
+        rs2 = new resolutionSyntax(999, 1000, 1);
+        assertTrue(rs2.lessThanOrEquals(rs1));
+
+        rs1 = new resolutionSyntax(1, 1, resolutionSyntax.DPCM);
+        rs2 = new resolutionSyntax(1, 2, resolutionSyntax.DPCM);
+        assertFalse(rs2.lessThanOrEquals(rs1));
+
+        try {
+            rs2 = null;
+            rs1.lessThanOrEquals(rs2);
+            fail("lessThanOrEquals(ResolutionSyntax other) " +
+                    "doesn't throw NullPointerException " +
+                    "if other is null");
+        } catch (NullPointerException e) {}
+    }
+
+
+    public final void testToString() {
+        rs1 = new resolutionSyntax(500, 50, 10);
+        assertEquals("5000x500 dphi", rs1.toString());
+        //System.out.println(rs1.toString());
+    }
+
+
+    public final void testToStringintString() {
+        rs1 = new resolutionSyntax(1024, 1034, 254);
+        assertEquals("1024x1034 dpcm", rs1.toString(254, "dpcm"));
+        //System.out.println(rs1.toString(254, "dpcm"));
+    }
+
+    /*
+     * Auxiliary class
+     */
+    public class resolutionSyntax extends ResolutionSyntax {
+
+        public  resolutionSyntax(int a, int b, int c) {
+            super(a, b, c);
+        }
+
+        public int getCrossFeedResolutionDphiEx() {
+            return getCrossFeedResolutionDphi();
+        }
+
+        public int getFeedResolutionDphiEx() {
+            return getFeedResolutionDphi();
+        }
+    }
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/ResolutionSyntaxTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/RunAllAttributesTests.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/RunAllAttributesTests.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/RunAllAttributesTests.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/RunAllAttributesTests.java Sun Oct  8 22:33:09 2006
@@ -0,0 +1,74 @@
+/*
+ *  Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+/** 
+ * @author Elena V. Sayapina 
+ * @version $Revision: 1.3 $ 
+ */ 
+
+package javax.print.attribute;
+
+import javax.print.attribute.standard.FinishingsTest;
+import javax.print.attribute.standard.JobStateReasonTest;
+import javax.print.attribute.standard.JobStateReasonsTest;
+import javax.print.attribute.standard.MediaNameTest;
+import javax.print.attribute.standard.MediaPrintableAreaTest;
+import javax.print.attribute.standard.MediaSizeNameTest;
+import javax.print.attribute.standard.MediaSizeTest;
+import javax.print.attribute.standard.MediaTest;
+import javax.print.attribute.standard.PrinterStateReasonTest;
+import javax.print.attribute.standard.PrinterStateReasonsTest;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+
+public class RunAllAttributesTests extends TestCase {
+
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run( suite() );
+    }
+
+    public static Test suite() {
+        TestSuite suite = new TestSuite("Run all JUnit Attributes Tests");
+
+        suite.addTest(new TestSuite(AttributeSetUtilitiesTest.class));
+        suite.addTest(new TestSuite(DateTimeSyntaxTest.class));
+        suite.addTest(new TestSuite(EnumSyntaxTest.class));
+        suite.addTest(new TestSuite(HashAttributeTest.class));
+        suite.addTest(new TestSuite(IntegerSyntaxTest.class));
+        suite.addTest(new TestSuite(ResolutionSyntaxTest.class));
+        suite.addTest(new TestSuite(SetOfIntegerSyntaxTest.class));
+        suite.addTest(new TestSuite(Size2DSyntaxTest.class));
+        suite.addTest(new TestSuite(TextSyntaxTest.class));
+        suite.addTest(new TestSuite(URISyntaxTest.class));
+
+        suite.addTest(new TestSuite(FinishingsTest.class));
+        suite.addTest(new TestSuite(JobStateReasonsTest.class));
+        suite.addTest(new TestSuite(JobStateReasonTest.class));
+        suite.addTest(new TestSuite(MediaTest.class));
+        suite.addTest(new TestSuite(MediaNameTest.class));
+        suite.addTest(new TestSuite(MediaPrintableAreaTest.class));
+        suite.addTest(new TestSuite(MediaSizeNameTest.class));
+        suite.addTest(new TestSuite(MediaSizeTest.class));
+        suite.addTest(new TestSuite(PrinterStateReasonsTest.class));
+        suite.addTest(new TestSuite(PrinterStateReasonTest.class));
+
+        return suite;
+    }
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/RunAllAttributesTests.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/SetOfIntegerSyntaxTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/SetOfIntegerSyntaxTest.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/SetOfIntegerSyntaxTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/SetOfIntegerSyntaxTest.java Sun Oct  8 22:33:09 2006
@@ -0,0 +1,311 @@
+/*
+ *  Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+/** 
+ * @author Elena V. Sayapina 
+ * @version $Revision: 1.3 $ 
+ */ 
+
+package javax.print.attribute;
+
+import javax.print.attribute.SetOfIntegerSyntax;
+import javax.print.attribute.standard.Copies;
+import javax.print.attribute.standard.NumberUpSupported;
+import javax.print.attribute.standard.PageRanges;
+
+import junit.framework.TestCase;
+
+public class SetOfIntegerSyntaxTest extends TestCase {
+
+    static{
+        System.out.println("SetOfIntegerSyntax testing...");
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(SetOfIntegerSyntaxTest.class);
+    }
+
+    SetOfIntegerSyntax set1, set2;
+    int[][] arr1, arr2;
+
+    /*
+     * setOfIntegerSyntax(String str) constructor testing. 
+     */
+    public final void testSetOfIntegerSyntax() {
+        try {
+            set1 = new setOfIntegerSyntax(
+                    " 16-37, 100:30, 17-50, 1000-1848, 1-2, 2147");
+            set1 = new setOfIntegerSyntax("0");
+            set1 = new setOfIntegerSyntax(
+                    "100       :       30,                  4");
+            set1 = new setOfIntegerSyntax("000-1848");
+            set1 = new setOfIntegerSyntax("");
+        } catch (Exception e) {
+            fail("Unexpected exception occurred: " + e.toString());
+        }
+
+        try {
+            set1 = new setOfIntegerSyntax("17-50 1000-160");
+            fail("IllegalArgumentException wasn't trown when expected");
+        } catch (IllegalArgumentException e) {
+        }
+
+        try {
+            set1 = new setOfIntegerSyntax("-16:12");
+            fail("IllegalArgumentException wasn't trown when expected");
+        } catch (IllegalArgumentException e) {
+        }
+
+        try {
+            set1 = new setOfIntegerSyntax("a");
+            fail("IllegalArgumentException wasn't trown when expected");
+        } catch (IllegalArgumentException e) {
+        }
+
+        try {
+            //fails in "some" environment
+            set1 = new setOfIntegerSyntax("19836475376");
+            fail("IllegalArgumentException wasn't trown when expected");
+        } catch (IllegalArgumentException e) {
+        }
+
+        set1 = new setOfIntegerSyntax(
+                " 16-37, 100:30, 17:50, 1000-1848, 1-2, 214748364, 3");
+        //System.out.println(set1.toString());
+        arr1 = set1.getMembers();
+        arr2 = new int[][] {{1,3}, {16,50}, {1000,1848}, {214748364, 214748364}};
+        if (arr1.length == arr2.length) {
+            for (int i=0; i<arr1.length; i++) {
+                if ((arr1[i][0] != arr2[i][0]) || (arr1[i][1] != arr2[i][1])) {
+                    fail("Wrong cannonical array");
+                }
+            }
+        } else {
+            fail("Wrong cannonical array");
+        }
+
+        set1 = new setOfIntegerSyntax(" ");
+        arr1 = set1.getMembers();
+        String str = null;
+        set2 = new setOfIntegerSyntax(str);
+        arr2 = set2.getMembers();
+        if (arr1.length != arr2.length || arr1.length != 0 ) {
+            fail("IllegalArgumentException wasn't trown when expected");
+        }
+        set1 = new setOfIntegerSyntax("15-2");
+        assertEquals(0, set1.getMembers().length);
+
+        try {
+            set1 = new setOfIntegerSyntax("1-2-3");
+            fail("IllegalArgumentException wasn't trown when expected");
+        } catch (IllegalArgumentException e) {
+        }
+
+    }
+
+    /*
+     * setOfIntegerSyntax(int member) constructor testing. 
+     */
+    public final void testSetOfIntegerSyntax1() {
+        try {
+            set1 = new setOfIntegerSyntax(-1);
+            fail("IllegalArgumentException wasn't trown when expected");
+        } catch (IllegalArgumentException e) {
+        }
+
+        try {
+            set1 = new setOfIntegerSyntax(0);
+            set2 = new setOfIntegerSyntax(1000);
+            assertEquals(0, set1.getMembers()[0][0]);
+            assertEquals(1000, set2.getMembers()[0][0]);
+        } catch (IllegalArgumentException e) {
+            fail("Unexpected exception " + e);
+        }
+    }
+
+    /*
+     * setOfIntegerSyntax(int[][] members) constructor testing. 
+     * Tests that .
+     */
+    public final void testSetOfIntegerSyntax2() {
+        try {
+            int[] arr = null;
+            arr1 = new int[][] {{9}, arr};
+            set1 = new setOfIntegerSyntax(arr1);
+            fail("NullPointerException wasn't trown when expected");
+        } catch (NullPointerException e) {
+        }
+        try {
+            arr1 = new int[][] {{9}, {4,5,6}};
+            set1 = new setOfIntegerSyntax(arr1);
+            fail("IllegalArgumentException wasn't trown when expected");
+        } catch (IllegalArgumentException e) {
+        }
+        try {
+            arr1 = new int[][] {{-9}, {4}};
+            set1 = new setOfIntegerSyntax(arr1);
+            fail("IllegalArgumentException wasn't trown when expected");
+        } catch (IllegalArgumentException e) {
+        }
+        try {
+            arr1 = new int[][] {{1,5}, {10}, {7,7}, {5,6}, {8,9}, {15,14}};
+            set1 = new setOfIntegerSyntax(arr1);
+            //System.out.println(set1.toString());
+            assertEquals(1, set1.getMembers()[0][0]);
+            assertEquals(10, set1.getMembers()[0][1]);
+        } catch (Exception e) {
+            fail("Unexpected exception occurred " + e);
+        }
+
+        arr1 = new int[][] {{15,14}};
+        set1 = new setOfIntegerSyntax(arr1);
+        assertEquals(0, set1.getMembers().length);
+
+    }
+
+    /*
+     * setOfIntegerSyntax(int lowerBound, int upperBound) constructor testing. 
+     */
+    public final void testSetOfIntegerSyntax3() {
+        try {
+            set1 = new setOfIntegerSyntax(10, 10);
+            assertEquals(10, set1.getMembers()[0][0]);
+            assertEquals(10, set1.getMembers()[0][1]);
+            set2 = new setOfIntegerSyntax(10, 1);
+            assertEquals(0, set2.getMembers().length);
+        } catch (IllegalArgumentException e) {
+            fail("Unexpected exception occurred " + e);
+        }
+        try {
+            arr1 = new int[][] {{-9}, {4}};
+            set1 = new setOfIntegerSyntax(arr1);
+            fail("IllegalArgumentException wasn't trown when expected");
+        } catch (IllegalArgumentException e) {
+        }
+    }
+
+    /*
+     * setOfIntegerSyntax(String string) constructor testing. 
+     */
+    public final void testSetOfIntegerSyntax4() {
+        String str = null;
+        set1 = new setOfIntegerSyntax(str);
+        assertTrue(0 == set1.getMembers().length);
+    }
+
+    /*
+     * contains(int x) method testing. 
+     */
+    public final void testContains() {
+        set1 = new setOfIntegerSyntax("0:8");
+        assertTrue(set1.contains(0));
+        assertTrue(set1.contains(8));
+        assertFalse(set1.contains(9));
+        assertFalse(set1.contains(-1));
+    }
+
+    /*
+     * contains(IntegerSyntax attribute) method testing. 
+     */
+    public final void testContains1() {
+        IntegerSyntax att1 = new Copies(10);
+        IntegerSyntax att2 = new Copies(1);
+        set1 = new setOfIntegerSyntax("10, 5-8");
+        assertTrue(set1.contains(att1));
+        assertFalse(set1.contains(att2));
+    }
+
+    /*
+     * equals(Object object) method testing. 
+     */
+    public final void testEquals() {
+        arr1 = new int[][] {{0,1}, {5}};
+        set1 = new setOfIntegerSyntax(arr1);
+        set2 = new setOfIntegerSyntax("0, 1, 5");
+        assertTrue(set1.equals(set2));
+
+        set1 = new PageRanges("2, 3-2");
+        set2 = new PageRanges(2);
+        assertTrue(set1.equals(set2));
+
+        set1 = new NumberUpSupported(2, 10);
+        set2 = new NumberUpSupported(2);
+        assertFalse(set1.equals(set2));
+
+        set1 = new setOfIntegerSyntax("100-1000");
+        set2 = null;
+        assertFalse(set1.equals(set2));
+    }
+
+    /*
+     * getMembers() method testing. 
+     */
+    public final void testGetMembers() {
+        set1 = new setOfIntegerSyntax("10, 5-8");
+        arr1 = set1.getMembers();
+        assertEquals(5, arr1[0][0]);
+        assertEquals(8, arr1[0][1]);
+        assertEquals(10, arr1[1][0]);
+        assertEquals(10, arr1[1][1]);
+    }
+
+    /*
+     * hashCode() method testing. 
+     * Tests that hash code is the sum of the lower and upper bounds of 
+     * the ranges in the canonical array form, or 0 for an empty set.
+     */
+    public final void testHashCode() {
+        set1 = new setOfIntegerSyntax("0, 1, 5, 10-15");
+        assertEquals(36, set1.hashCode());
+        set1 = new setOfIntegerSyntax(" ");
+        assertEquals(0, set1.hashCode());
+        set1 = new setOfIntegerSyntax("5");
+        assertEquals(10, set1.hashCode());
+    }
+
+    /*
+     * next() method testing.
+     */
+    public final void testNext() {
+        set1 = new setOfIntegerSyntax(" 5-8, 10, 25, 100-130, 250");
+        assertEquals(10, set1.next(8));
+        assertEquals(5, set1.next(1));
+        assertEquals(-1, set1.next(250));
+    }
+
+
+    /*
+     * Auxiliary class
+     */
+    public class setOfIntegerSyntax extends SetOfIntegerSyntax {
+
+        public setOfIntegerSyntax(int lowerBound, int upperBound) {
+            super(lowerBound, upperBound);
+        }
+
+        public setOfIntegerSyntax(String str) {
+            super(str);
+        }
+
+        public setOfIntegerSyntax(int i) {
+            super(i);
+        }
+
+        public setOfIntegerSyntax(int[][] arr) {
+            super(arr);
+        }
+    }
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/SetOfIntegerSyntaxTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/Size2DSyntaxTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/Size2DSyntaxTest.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/Size2DSyntaxTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/Size2DSyntaxTest.java Sun Oct  8 22:33:09 2006
@@ -0,0 +1,237 @@
+/*
+ *  Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+/** 
+ * @author Elena V. Sayapina 
+ * @version $Revision: 1.3 $ 
+ */ 
+
+package javax.print.attribute;
+
+import junit.framework.TestCase;
+
+
+
+public class Size2DSyntaxTest extends TestCase {
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(Size2DSyntaxTest.class);
+    }
+
+    static {
+        System.out.println("Size2DSyntax testing...");
+    }
+
+
+    size2DSyntax ss1, ss2;
+
+
+    /*
+     * Size2DSyntax(float x, float y, int units) constructor testing. 
+     */
+    public final void testSize2DSyntax() {
+
+        ss1 = new size2DSyntax(0.1f, 22.22f, Size2DSyntax.MM);
+        assertTrue(100 == ss1.getXMicrometersEx());
+        assertTrue(22220 == ss1.getYMicrometersEx());
+
+        try {
+            ss1 = new size2DSyntax(-0.01f, 700.45f, Size2DSyntax.MM);
+            fail("Size2DSyntax(float x, float y, int units) " +
+                    "doesn't throw IllegalArgumentException x<0");
+        } catch (IllegalArgumentException e) {}
+
+        try {
+            ss1 = new size2DSyntax(0.1f, -700.45f, Size2DSyntax.MM);
+            fail("Size2DSyntax(float x, float y, int units) " +
+                    "doesn't throw IllegalArgumentException y<0");
+        } catch (IllegalArgumentException e) {}
+
+        try {
+            ss1 = new size2DSyntax(0.1f, 0.1f, 0);
+            fail("Size2DSyntax(float x, float y, int units) " +
+                    "doesn't throw IllegalArgumentException units<1");
+        } catch (IllegalArgumentException e) {}
+
+    }
+
+    /*
+     * Size2DSyntax(int x, int y, int units) constructor testing. 
+     */
+    public final void testSize2DSyntax1() {
+
+        ss1 = new size2DSyntax(1, 10, Size2DSyntax.INCH);
+        assertTrue(25400 == ss1.getXMicrometersEx());
+        assertTrue(254000 == ss1.getYMicrometersEx());
+
+        try {
+            ss1 = new size2DSyntax(-2, 1, Size2DSyntax.MM);
+            fail("Size2DSyntax(float x, float y, int units) " +
+                    "doesn't throw IllegalArgumentException x<0");
+        } catch (IllegalArgumentException e) {}
+
+        try {
+            ss1 = new size2DSyntax(1, -1, Size2DSyntax.MM);
+            fail("Size2DSyntax(float x, float y, int units) " +
+                    "doesn't throw IllegalArgumentException y<0");
+        } catch (IllegalArgumentException e) {}
+
+        try {
+            ss1 = new size2DSyntax(1, 1, -26);
+            fail("Size2DSyntax(float x, float y, int units) " +
+                    "doesn't throw IllegalArgumentException units<1");
+        } catch (IllegalArgumentException e) {}
+    }
+
+    /*
+     * hashCode() method testing. 
+     */
+    public final void testHashCode() {
+
+        ss1 = new size2DSyntax(10, 10, 2);
+        ss2 = new size2DSyntax(1, 1, 20);
+        assertEquals(ss1.hashCode(), ss2.hashCode());
+
+        ss1 = new size2DSyntax(10, 10, 2);
+        ss2 = new size2DSyntax(10, 10, 20);
+        assertFalse(ss1.hashCode() == ss2.hashCode());
+
+    }
+
+    /*
+     * equals(Object object) method testing. 
+     */
+    public final void testEqualsObject() {
+        ss1 = new size2DSyntax(10, 10, 2);
+        ss2 = new size2DSyntax(1, 1, 20);
+        assertTrue(ss1.equals(ss2));
+
+        ss1 = new size2DSyntax(10, 10, 2);
+        ss2 = new size2DSyntax(10, 10, 20);
+        assertFalse(ss1.equals(ss2));
+
+        ss2 = null;
+        assertFalse(ss1.equals(ss2));
+    }
+
+    /*
+     * getSize(int units) method testing. 
+     */
+    public final void testGetSize() {
+        ss1 = new size2DSyntax(10.2f, 100f, 2);
+        float[] size = ss1.getSize(2);
+        assertEquals(10.2, size[0], 1);
+        assertEquals(100, size[1], 1);
+        try {
+            ss1.getSize(0);
+            fail("getSize(int units) " +
+                    "doesn't throw IllegalArgumentException units<1");
+        } catch (IllegalArgumentException e) {}
+    }
+
+    /*
+     * getX(int units) method testing. 
+     */
+    public final void testGetX() {
+        ss1 = new size2DSyntax(500.f, 800f, 1);
+        assertEquals(62.5f, ss1.getX(8), 0.0001);
+
+        ss1 = new size2DSyntax(105f, 800f, 10);
+        assertEquals(5.25f, ss1.getX(200), 0.0001);
+
+        try {
+            ss1.getX(0);
+            fail("getX(int units) " +
+                    "doesn't throw IllegalArgumentException units<1");
+        } catch (IllegalArgumentException e) {}
+    }
+
+    /*
+     * getY(int units) method testing. 
+     */
+    public final void testGetY() {
+        ss1 = new size2DSyntax(500, 700, 1);
+        assertEquals(17.5, ss1.getY(40), 0.0001);
+
+        ss1 = new size2DSyntax(500, 700, 10);
+        assertEquals(583.3333, ss1.getY(12), 0.0001);
+
+        try {
+            ss1.getY(-44);
+            fail("getY(int units) " +
+                    "doesn't throw IllegalArgumentException units<1");
+        } catch (IllegalArgumentException e) {}
+    }
+
+    /*
+     * getXMicrometers() method testing. 
+     */
+    public final void testGetXMicrometers() {
+        ss1 = new size2DSyntax(500.3f, 700.45f, 1);
+        assertEquals(500, ss1.getXMicrometersEx());
+
+        ss1 = new size2DSyntax(500.08f, 700.5f, 10);
+        assertEquals(5001, ss1.getXMicrometersEx());
+    }
+
+    /*
+     * getYMicrometers() method testing. 
+     */
+    public final void testGetYMicrometers() {
+        ss1 = new size2DSyntax(500.3f, 700.45f, 1);
+        assertEquals(700, ss1.getYMicrometersEx());
+
+        ss1 = new size2DSyntax(500.3f, 700.07f, 10);
+        assertEquals(7001, ss1.getYMicrometersEx());
+    }
+
+    /*
+     * toString(int units, String unitsName) method testing. 
+     */
+    public final void testToStringintString() {
+        size2DSyntax s = new  size2DSyntax(500f, 50f, 10);
+        //System.out.println(s.toString(20, "mm"));
+        try {
+            s.toString(-1, "");
+            fail("toString(int units, String unitsName) " +
+                    "doesn't throw IllegalArgumentException units<1");
+        } catch (IllegalArgumentException e) {}
+    }
+
+
+    /*
+     * Auxiliary class
+     */
+    public class size2DSyntax extends  Size2DSyntax {
+
+        public size2DSyntax(float a, float b, int c) {
+            super(a, b, c);
+        }
+
+        public size2DSyntax(int a, int b, int c) {
+            super(a, b, c);
+        }
+
+        protected int getXMicrometersEx() {
+            return getXMicrometers();
+        }
+
+        protected int getYMicrometersEx() {
+            return getYMicrometers();
+        }
+    }
+
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/Size2DSyntaxTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/TextSyntaxTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/TextSyntaxTest.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/TextSyntaxTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/TextSyntaxTest.java Sun Oct  8 22:33:09 2006
@@ -0,0 +1,126 @@
+/*
+ *  Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+/** 
+ * @author Elena V. Sayapina 
+ * @version $Revision: 1.3 $ 
+ */ 
+
+package javax.print.attribute;
+
+import java.util.Locale;
+
+import junit.framework.TestCase;
+
+
+public class TextSyntaxTest extends TestCase {
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(TextSyntaxTest.class);
+    }
+
+    static {
+        System.out.println("TextSyntax testing...");
+    }
+
+    TextSyntax ts1, ts2;
+
+    /*
+     * TextSyntax() constructor testing. 
+     */
+    public final void testTextSyntax() {
+        try {
+            String str = null;
+            ts1 = new textSyntax(str, Locale.UK);
+            fail("NullPointerException wasn't trown when expected");
+        } catch (NullPointerException e) {
+        }
+
+        ts1 = new textSyntax("text", null);
+        assertEquals(Locale.getDefault(), ts1.getLocale());
+        assertEquals("text", ts1.getValue());
+    }
+
+    /*
+     * hashCode() method testing. 
+     */
+    public final void testHashCode() {
+
+        ts1 = new textSyntax("hello", Locale.UK);
+        ts2 = new textSyntax("hello", Locale.UK);
+        assertEquals(ts1, ts2);
+
+        ts1 = new textSyntax("", Locale.UK);
+        ts2 = new textSyntax("", Locale.CANADA);
+        assertFalse(ts1 == ts2);
+    }
+
+    /*
+     * equals(Object object) method testing. 
+     */
+    public final void testEqualsObject() {
+
+        ts1 = new textSyntax("text", Locale.UK);
+        ts2 = new textSyntax("text", Locale.UK);
+        assertTrue(ts1.equals(ts2));
+
+
+        ts1 = new textSyntax(" a", Locale.UK);
+        ts2 = new textSyntax("a", Locale.UK);
+        assertFalse(ts1.equals(ts2));
+    }
+
+    /*
+     * getLocale() method testing. 
+     */
+    public final void testGetLocale() {
+        Locale locale = Locale.ITALY;
+        ts1 = new textSyntax("text", locale);
+        assertEquals(locale, ts1.getLocale());
+
+        ts1 = new textSyntax("text", null);
+        assertNotNull(ts1.getLocale());
+    }
+
+    /*
+     * getValue() method testing. 
+     */
+    public final void testGetValue() {
+        ts1 = new textSyntax("Hello world!", null);
+        assertEquals("Hello world!", ts1.getValue());
+    }
+
+    /*
+     * toString() method testing. 
+     */
+    public final void testToString() {
+        Locale locale = Locale.ITALY;
+        ts1 = new textSyntax(" text ", locale);
+        assertEquals(" text ", ts1.toString());
+    }
+
+
+    /*
+     * Auxiliary class
+     */
+    public class textSyntax extends TextSyntax {
+
+        public textSyntax(String value, Locale locale) {
+            super(value, locale);
+        }
+    }
+
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/TextSyntaxTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/URISyntaxTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/URISyntaxTest.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/URISyntaxTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/URISyntaxTest.java Sun Oct  8 22:33:09 2006
@@ -0,0 +1,131 @@
+/*
+ *  Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+/** 
+ * @author Elena V. Sayapina 
+ * @version $Revision: 1.3 $ 
+ */ 
+
+package javax.print.attribute;
+
+import java.net.URI;
+
+import junit.framework.TestCase;
+
+
+public class URISyntaxTest extends TestCase {
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(URISyntaxTest.class);
+    }
+
+    static {
+        System.out.println("URISyntax testing...");
+    }
+
+    uriSyntax us1, us2;
+    URI uri1, uri2;
+
+
+    /*
+     * URISyntax() constructor testing. 
+     */
+    public final void testURISyntax() {
+        try {
+            uri1 = new URI("http://news.ngs.ru/more/14161.shtml");
+            us1 = new uriSyntax(uri1);
+        } catch (Exception e) {
+            fail("Unexpected exception occurred " + e);
+        }
+        try {
+            uri1 = null;
+            us1 = new uriSyntax(uri1);
+            fail("NullPointerException wasn't thrown when expected");
+        } catch (NullPointerException e) {
+        }
+
+    }
+
+    /*
+     * hashCode() method testing. 
+     */
+    public final void testHashCode() {
+        try {
+            uri1 = new URI("http://www.ietf.org/rfc/rfc2396.txt");
+            us1 = new uriSyntax(uri1);
+            assertTrue(us1.hashCode() == us1.hashCode());
+
+            uri1 = new URI("http://www.ietf.org/rfc/rfc2396.txt");
+            us1 = new uriSyntax(uri1);
+            uri2 = new URI("http://www.ietf.org/rfc/rfc2395.txt");
+            us2 = new uriSyntax(uri2);
+            assertFalse(us1.hashCode() == us2.hashCode());
+
+        } catch (Exception e) {
+            fail("Unexpected exception occurred " + e);
+        }
+
+    }
+
+    /*
+     * equals(Object object) method testing. 
+     */
+    public final void testEqualsObject() {
+        try {
+            uri1 = new URI("http://www.melodi.ru/main/index.php#");
+            us1 = new uriSyntax(uri1);
+            assertTrue(us1.equals(us1));
+
+            uri1 = new URI("http://www.ietf.org/rfc/rfc2396.txt");
+            us1 = new uriSyntax(uri1);
+            uri2 = new URI("http://www.ietf.org/rfc/rfc2395.txt");
+            us2 = new uriSyntax(uri2);
+            assertFalse(us1.equals(us2));
+
+        } catch (Exception e) {
+            fail("Unexpected exception occurred " + e);
+        }
+    }
+
+    /*
+     * getURI() method testing. 
+     */
+    public final void testGetURI() {
+        try {
+            uri1 = new URI("http://www.melodi.ru/main/index.php#");
+            us1 = new uriSyntax(uri1);
+            assertEquals(uri1, us1.getURI());
+
+            uri2 = new URI("http://www.ietf.org/rfc/rfc2395.txt");
+            us2 = new uriSyntax(uri2);
+            assertEquals(uri2, us2.getURI());
+
+        } catch (Exception e) {
+            fail("Unexpected exception occurred " + e);
+        }
+    }
+
+
+    /*
+     * Auxiliary class
+     */
+    public class uriSyntax extends URISyntax {
+
+        public uriSyntax(URI uri){
+            super(uri);
+        }
+    }
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/URISyntaxTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/standard/FinishingsTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/standard/FinishingsTest.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/standard/FinishingsTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/standard/FinishingsTest.java Sun Oct  8 22:33:09 2006
@@ -0,0 +1,150 @@
+/*
+ *  Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+/** 
+ * @author Elena V. Sayapina 
+ * @version $Revision: 1.3 $ 
+ */ 
+
+package javax.print.attribute.standard;
+
+import javax.print.attribute.EnumSyntax;
+
+import junit.framework.TestCase;
+
+public class FinishingsTest extends TestCase {
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(FinishingsTest.class);
+    }
+
+    static {
+        System.out.println("Finishings testing...");
+    }
+
+    finishings fin;
+
+
+    /*
+     * Finishings constructor testing.
+     */
+    public final void testFinishings() {
+
+        Finishings finishings = new finishings(20);
+        assertEquals(20, finishings.getValue());
+
+        fin = new finishings(40);
+        assertEquals(40, fin.getValue());
+
+        finishings = Finishings.BIND;
+        assertEquals("bind", finishings.toString());
+        assertTrue(finishings.getValue() < 18);
+        assertTrue(finishings.getValue() > 0);
+
+    }
+
+
+    /*
+     * getCategory() method testing.
+     */
+    public final void testGetCategory() {
+
+        Finishings finishings = Finishings.NONE;
+        assertEquals(Finishings.class, finishings.getCategory());
+    }
+
+    /*
+     * getName() method testing.
+     */
+    public final void testGetName() {
+        Finishings finishings = Finishings.SADDLE_STITCH;
+        assertEquals("finishings", finishings.getName());
+    }
+
+    /*
+     * getStringTable() method testing.
+     */
+    public final void testGetStringTable() {
+
+        int quantity = 0;
+        fin = new finishings(20);
+        String[] str = fin.getStringTableEx();
+        for (int i = 0; i < str.length; i++) {
+            if (str[i] != null) {
+                quantity++;
+            }
+            //System.out.println(str[i]);
+        }
+        assertEquals(18, quantity);
+
+        //Tests that StringTable isn't changed for Finishings
+        fin = new finishings(3);
+        str[3] = "finishings3";
+        //System.out.println((fin.getStringTableEx()[3]);
+        assertFalse(fin.getStringTableEx()[3].equals("finishings3"));
+
+        Finishings finishings = Finishings.STAPLE_TOP_LEFT;
+        assertEquals("staple-top-left", finishings.toString());
+    }
+
+    /*
+     * getEnumValueTable() method testing.
+     */
+    public final void testGetEnumValueTable() {
+        int quantity = 0;
+        fin = new finishings(20);
+        EnumSyntax[] table = fin.getEnumValueTableEx();
+        for (int i = 0; i < table.length; i++) {
+            if (table[i] != null) {
+                quantity++;
+            }
+        }
+        assertEquals(18, quantity);
+    }
+
+    /*
+     * getOffset() method testing.
+     */
+    public final void testGetOffset() {
+        fin = new finishings(5);
+        assertEquals(3, fin.getOffsetEx());
+    }
+
+
+    /*
+     * Auxiliary class
+     */
+    public class finishings extends Finishings {
+
+        public finishings(int value) {
+            super(value);
+        }
+
+        public String[] getStringTableEx() {
+            return getStringTable();
+        }
+
+        public EnumSyntax[] getEnumValueTableEx() {
+            return getEnumValueTable();
+        }
+
+        public int getOffsetEx() {
+            return getOffset();
+        }
+    }
+
+
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/standard/FinishingsTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/standard/JobStateReasonTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/standard/JobStateReasonTest.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/standard/JobStateReasonTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/standard/JobStateReasonTest.java Sun Oct  8 22:33:09 2006
@@ -0,0 +1,109 @@
+/*
+ *  Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+/** 
+ * @author Elena V. Sayapina 
+ * @version $Revision: 1.3 $ 
+ */ 
+
+package javax.print.attribute.standard;
+
+import javax.print.attribute.EnumSyntax;
+
+import junit.framework.TestCase;
+
+public class JobStateReasonTest extends TestCase {
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(JobStateReasonTest.class);
+    }
+
+    static {
+        System.out.println("JobStateReason testing...");
+    }
+
+    jobStateReason reason;
+
+
+    /*
+     * JobStateReason constructor testing.
+     */
+    public final void testFinishings() {
+
+        reason = new jobStateReason(20);
+        assertEquals(20, reason.getValue());
+
+        reason = new jobStateReason(40);
+        assertEquals(40, reason.getValue());
+        assertEquals("40", reason.toString());
+    }
+
+    /*
+     * getEnumValueTable(), getStringTable() methods testing.
+     */
+    public final void testGetStringTable() {
+
+        int quantity = 0;
+        reason = new jobStateReason(5);
+        String[] str = reason.getStringTableEx();
+        EnumSyntax[] table = reason.getEnumValueTableEx();
+        assertEquals(str.length, table.length);
+        assertTrue(29 == table.length);
+
+        //Tests that StringTable isn't changed for JobStateReason
+        reason = new jobStateReason(1);
+        str = reason.getStringTableEx();
+        str[1] = "reason1";
+        //System.out.println(reason.getStringTable()[1]);
+        assertFalse(reason.getStringTableEx()[1].equals("reason1"));
+    }
+
+    /*
+     * getCategory() method testing.
+     */
+    public final void testGetCategory() {
+        JobStateReason jsreason = JobStateReason.ABORTED_BY_SYSTEM;
+        assertEquals(JobStateReason.class, jsreason.getCategory());
+    }
+
+    /*
+     * getName() method testing.
+     */
+    public final void testGetName() {
+        JobStateReason jsreason = JobStateReason.UNSUPPORTED_DOCUMENT_FORMAT;
+        assertEquals("job-state-reason", jsreason.getName());
+    }
+
+
+    /*
+     * Auxiliary class
+     */
+    public class jobStateReason extends JobStateReason {
+
+        public jobStateReason(int value) {
+            super(value);
+        }
+
+        public String[] getStringTableEx() {
+            return getStringTable();
+        }
+
+        public EnumSyntax[] getEnumValueTableEx() {
+            return getEnumValueTable();
+        }
+    }
+
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/standard/JobStateReasonTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/standard/JobStateReasonsTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/standard/JobStateReasonsTest.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/standard/JobStateReasonsTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/standard/JobStateReasonsTest.java Sun Oct  8 22:33:09 2006
@@ -0,0 +1,143 @@
+/*
+ *  Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+/** 
+ * @author Elena V. Sayapina 
+ * @version $Revision: 1.3 $ 
+ */ 
+
+package javax.print.attribute.standard;
+
+import java.util.ArrayList;
+
+import junit.framework.TestCase;
+
+public class JobStateReasonsTest extends TestCase {
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(JobStateReasonsTest.class);
+    }
+
+    static {
+        System.out.println("JobStateReasons testing...");
+    }
+
+
+
+    /*
+     * JobStateReasons() constructor testing. 
+     */
+    public final void testJobStateReasons() {
+        JobStateReasons jsrs = new JobStateReasons();
+        assertEquals(0, jsrs.size());
+    }
+
+    /*
+     * JobStateReasons(Collection collection) constructor testing. 
+     */
+    public final void testJobStateReasonsCollection() {
+
+        ArrayList list = new ArrayList(5);
+        list.add(JobStateReason.ABORTED_BY_SYSTEM);
+        list.add(JobStateReason.COMPRESSION_ERROR);
+        list.add(JobStateReason.DOCUMENT_ACCESS_ERROR);
+        list.add(JobState.ABORTED);
+        try {
+            JobStateReasons jsreasons = new JobStateReasons(list);
+            fail("Constructor doesn't throw ClassCastException if " +
+                    "some element of the collection isn't JobStateReason");
+        } catch (ClassCastException e) {
+        }
+
+        list.remove(JobState.ABORTED);
+        JobStateReasons jsrs = new JobStateReasons(list);
+        JobStateReason reason = null;
+        list.add(reason);
+        try {
+            JobStateReasons jsreasons = new JobStateReasons(list);
+            fail("Constructor doesn't throw NullPointerException if " +
+                    "some element of the collection is null");
+        } catch (NullPointerException e) {
+        }
+
+        list.remove(reason);
+        JobStateReasons jsreasons = new JobStateReasons(list);
+        assertEquals(3, jsreasons.size());
+        assertTrue(jsreasons.contains(JobStateReason.ABORTED_BY_SYSTEM));
+        assertTrue(jsreasons.contains(JobStateReason.COMPRESSION_ERROR));
+        assertTrue(jsreasons.contains(JobStateReason.DOCUMENT_ACCESS_ERROR));
+    }
+
+    /*
+     * JobStateReasons(int initialCapacity) constructor testing. 
+     */
+    public final void testJobStateReasonsint() {
+        try {
+            JobStateReasons jsreasons = new JobStateReasons(-1);
+            fail("Constructor doesn't throw IllegalArgumentException if " +
+            "initialCapacity < 0");
+        } catch (IllegalArgumentException e) {
+        }
+    }
+
+    /*
+     *add(JobStateReason jsr) method testing. 
+     */
+    public final void testAdd() {
+
+        JobStateReasons jsreasons = new JobStateReasons(5);
+        assertTrue(jsreasons.add(JobStateReason.ABORTED_BY_SYSTEM));
+        assertFalse(jsreasons.add(JobStateReason.ABORTED_BY_SYSTEM));
+
+        try {
+            assertTrue(jsreasons.add(MediaTray.BOTTOM));
+            fail("Method doesn't throw ClassCastException if " +
+                    "adding element isn't JobStateReason");
+        } catch (ClassCastException e) {
+        }
+
+        try {
+            assertTrue(jsreasons.add(null));
+            fail("Method doesn't throw NullPointerException if " +
+                    "adding element is null");
+        } catch (NullPointerException e) {
+        }
+
+        ArrayList list = new ArrayList(5);
+        list.add(JobStateReason.COMPRESSION_ERROR);
+        list.add(JobStateReason.JOB_PRINTING);
+        jsreasons = new JobStateReasons(list);
+        assertTrue(jsreasons.add(JobStateReason.ABORTED_BY_SYSTEM));
+        assertFalse(jsreasons.add(JobStateReason.JOB_PRINTING));
+    }
+
+    /*
+     * getCategory() method testing.
+     */
+    public final void testGetCategory() {
+        JobStateReasons jsreasons = new JobStateReasons();
+        assertEquals(JobStateReasons.class, jsreasons.getCategory());
+    }
+
+    /*
+     * getName() method testing.
+     */
+    public final void testGetName() {
+        JobStateReasons jsreasons = new JobStateReasons();
+        assertEquals("job-state-reasons", jsreasons.getName());
+    }
+
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/standard/JobStateReasonsTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/standard/MediaNameTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/standard/MediaNameTest.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/standard/MediaNameTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/standard/MediaNameTest.java Sun Oct  8 22:33:09 2006
@@ -0,0 +1,114 @@
+/*
+ *  Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+/** 
+ * @author Elena V. Sayapina 
+ * @version $Revision: 1.3 $ 
+ */ 
+
+package javax.print.attribute.standard;
+
+import javax.print.attribute.EnumSyntax;
+
+import junit.framework.TestCase;
+
+public class MediaNameTest extends TestCase {
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(MediaNameTest.class);
+    }
+
+    static {
+        System.out.println("MediaName testing...");
+    }
+
+    mediaName name;
+
+    /*
+     * MediaName constructor testing.
+     */
+    public final void testMediaName() {
+        name = new mediaName(11);
+        assertEquals(11, name.getValue());
+        assertEquals("11", name.toString());
+
+        name = new mediaName(1111);
+        assertEquals(1111, name.getValue());
+        assertEquals("1111", name.toString());
+    }
+
+
+    /*
+     * getStringTable() method testing.
+     */
+    public void testGetStringTable() {
+        int quantity = 0;
+        mediaName mn = new mediaName(1);
+        String[] str = mn.getStringTableEx();
+        String[] str1 = { "na-letter-white",
+                          "na-letter-transparent",
+                          "iso-a4-white",
+                          "iso-a4-transparent"};
+        for (int j=0; j < str.length; j++) {
+            quantity++;
+            assertEquals(str1[j], str[j]);
+        }
+        assertEquals(4, quantity);
+    }
+
+    /*
+     * getEnumValueTable() method testing.
+     */
+    public final void testGetEnumValueTable() {
+        int quantity = 0;
+        mediaName mn = new mediaName(1);
+        EnumSyntax[] table = mn.getEnumValueTableEx();
+        assertEquals(4, table.length);
+    }
+
+    /*
+     * Checks that enumTable and stringTable are immutable for
+     * MediaName class
+     */
+    public final void testGetEnumValueTable1() {
+        name = new mediaName(1);
+        String[] str = name.getStringTableEx();
+        EnumSyntax[] table = name.getEnumValueTableEx();
+        str[1] = "media1";
+        table[1] = new mediaName(10);
+        //System.out.println(name.getEnumValueTable()[1]);
+        assertFalse(name.getEnumValueTableEx()[1].equals("media"));
+        assertFalse(name.getEnumValueTableEx()[1].equals(table[1]));
+    }
+
+
+    /*
+     * Auxiliary class
+     */
+    public class mediaName extends MediaName {
+
+        public mediaName(int value) {
+            super(value);
+        }
+
+        public String[] getStringTableEx() {
+            return getStringTable();
+        }
+
+        public EnumSyntax[] getEnumValueTableEx() {
+            return getEnumValueTable();
+        }
+    }
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/standard/MediaNameTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/standard/MediaPrintableAreaTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/standard/MediaPrintableAreaTest.java?view=auto&rev=454289
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/standard/MediaPrintableAreaTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/standard/MediaPrintableAreaTest.java Sun Oct  8 22:33:09 2006
@@ -0,0 +1,148 @@
+/*
+ *  Copyright 2005 - 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+/** 
+ * @author Elena V. Sayapina 
+ * @version $Revision: 1.3 $ 
+ */ 
+
+package javax.print.attribute.standard;
+
+import junit.framework.TestCase;
+
+public class MediaPrintableAreaTest extends TestCase {
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(MediaPrintableAreaTest.class);
+    }
+
+    static {
+        System.out.println("MediaPrintableArea testing...");
+    }
+
+    MediaPrintableArea mpa1, mpa2;
+
+    /*
+     * MediaPrintableArea(int x, int y, int width, int height, 
+     * int units)  constructors testing.
+     */
+    public void testMediaPrintableArea() {
+        try {
+            mpa1 = new MediaPrintableArea(20, 20, 100, 100, 0);
+            fail("Constructor doesn't throw IllegalArgumentException if " +
+                    "units < 1");
+        } catch (IllegalArgumentException e) {
+
+        }
+        try {
+            mpa1 = new MediaPrintableArea(-2, 2, 1, 1, 1);
+            fail("Constructor doesn't throw IllegalArgumentException if " +
+                    "x < 0");
+        } catch (IllegalArgumentException e) {
+
+        }
+    }
+
+    /*
+     * MediaPrintableArea(float x, float y, float width, float height, 
+     * int units)  constructors testing.
+     */
+    public void testMediaPrintableArea1() {
+
+         mpa1 = new MediaPrintableArea(0.4f, 0.5f, 9.9f, 3.4f, 1);
+         assertEquals(0.0f, mpa1.getX(1), 0.001f);
+         assertEquals(1.0f, mpa1.getY(1), 0.001f);
+         assertEquals(3.0f, mpa1.getHeight(1), 0.001f);
+         assertEquals(10.0f, mpa1.getWidth(1), 0.001f);
+    }
+
+    /*
+     * hashCode() method testing. Tests if two object is the same they must 
+     * have the same hashCodes.
+     */
+    public void testHashCode() {
+        mpa1 = new MediaPrintableArea(20, 20, 100, 100, MediaPrintableArea.INCH);
+        mpa2 = new MediaPrintableArea(20, 20, 100, 100, MediaPrintableArea.INCH);
+        assertEquals(mpa1.hashCode(), mpa2.hashCode());
+    }
+
+    /*
+     * hashCode() method testing. Tests if two object is different they should 
+     * have different hashCodes.
+     */
+    public void testHashCode1() {
+        mpa1 = new MediaPrintableArea(20, 20, 100, 100, MediaPrintableArea.INCH);
+        mpa2 = new MediaPrintableArea(20, 20, 100, 100, MediaPrintableArea.MM);
+        assertFalse(mpa1.hashCode() == mpa2.hashCode());
+    }
+
+    /*
+     * equals(Object object) method testing.
+     */
+    public void testEqualsObject() {
+
+        mpa1 = new MediaPrintableArea(1, 1, 1, 1, MediaPrintableArea.INCH);
+        mpa2 = new MediaPrintableArea(25400, 25400, 25400, 25400, 1);
+        assertTrue(mpa1.equals(mpa2));
+
+        mpa1 = new MediaPrintableArea(20, 20, 10, 10, MediaPrintableArea.INCH);
+        mpa2 = new MediaPrintableArea(20, 20, 10, 10, MediaPrintableArea.MM);
+        assertFalse(mpa1.equals(mpa2));
+
+        mpa2 = null;
+        assertFalse(mpa1.equals(mpa2));
+    }
+
+    /*
+     * getCategory() method testing.
+     */
+    public void testGetCategory() {
+        mpa1 = new MediaPrintableArea(1, 1, 1, 1, 1);
+        assertEquals(MediaPrintableArea.class, mpa1.getCategory());
+    }
+
+    /*
+     * getName() method testing.
+     */
+    public void testGetName() {
+        mpa1 = new MediaPrintableArea(1, 1, 1, 1, 1);
+        assertEquals("media-printable-area", mpa1.getName());
+    }
+
+    /*
+     * getX(), getY(), getHeight(), getHeight() methods testing.
+     */
+    public void testGetX() {
+        mpa1 = new MediaPrintableArea(1, 100, 1, 1, 1);
+        assertEquals(0.01f, mpa1.getX(100), 0.01f);
+        assertEquals(1.0f, mpa1.getY(100), 0.01f);
+        assertEquals(0.333f, mpa1.getWidth(3), 0.001f);
+        assertEquals(0.05f, mpa1.getHeight(20), 0.01f);
+    }
+
+
+    /*
+     * toString() method checking.
+     */
+    public void testToString() {
+
+        mpa1 = new MediaPrintableArea(20.0f, 20.0f, 100.0f, 100.0f, 254000);
+        //System.out.println(mpa1.toString(254000, "inch"));
+
+        mpa1 = new MediaPrintableArea(20,20,100,100, 1000);
+        //System.out.println(mpa1.toString());
+    }
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/H-1609/modules/print/src/test/api/java/common/javax/print/attribute/standard/MediaPrintableAreaTest.java
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message