harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r589730 - in /harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print: ./ attribute/ attribute/standard/
Date Mon, 29 Oct 2007 16:49:18 GMT
Author: odeakin
Date: Mon Oct 29 09:49:01 2007
New Revision: 589730

URL: http://svn.apache.org/viewvc?rev=589730&view=rev
Log:
Let JUnit deal with unexpected Exceptions rather than catching them ourselves - print module.

Modified:
    harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/IsAttributeValueSupportedTest.java
    harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/LookupDefaultPrintServiceTest.java
    harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/LookupMultiDocPrintServicesTest.java
    harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/LookupPrintServicesTest.java
    harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/PrintAutosenseTest.java
    harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/PrintJpegTest.java
    harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/ValueTests.java
    harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/AttributeSetUtilitiesTest.java
    harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/EnumSyntaxTest.java
    harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/HashAttributeTest.java
    harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/SetOfIntegerSyntaxTest.java
    harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/URISyntaxTest.java
    harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/standard/MediaTest.java

Modified: harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/IsAttributeValueSupportedTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/IsAttributeValueSupportedTest.java?rev=589730&r1=589729&r2=589730&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/IsAttributeValueSupportedTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/IsAttributeValueSupportedTest.java
Mon Oct 29 09:49:01 2007
@@ -50,57 +50,52 @@
             System.out.println("----------- " + services[i].getName()
                     + "----------");
 
-            try {
-                uri1 = new URI("file:///foo/bar");
-                uri2 = new URI("file:///F:/printing/tmp/print.out");
-                uri3 = new URI("file:///F:/printing/tmp/xxx/print.out");
+            uri1 = new URI("file:///foo/bar");
+            uri2 = new URI("file:///F:/printing/tmp/print.out");
+            uri3 = new URI("file:///F:/printing/tmp/xxx/print.out");
 
-                Attribute[] attrs = { MediaSizeName.ISO_A0,
-                        Finishings.NONE,
-                        Finishings.EDGE_STITCH,
-                        MediaSizeName.ISO_A2,
-                        MediaSizeName.ISO_A3,
-                        new Destination(uri1),
-                        new Destination(uri2),
-                        new Destination(uri3),
-                        new DocumentName("xyz", Locale.US),
-                        new JobName("xyz", Locale.US),
-                        new RequestingUserName("xyz", Locale.US),
-                        Sides.DUPLEX,
-                        Sides.ONE_SIDED,
-                        Sides.TUMBLE,
-                        Sides.TWO_SIDED_LONG_EDGE,
-                        Sides.TWO_SIDED_SHORT_EDGE,
-                        null };
-                for (int a = 0, ac = attrs.length; a < ac; a++) {
-                    try {
-                        supported = services[i].isAttributeValueSupported(
-                                attrs[a], DocFlavor.INPUT_STREAM.GIF, null);
-                    } catch (NullPointerException e1) {
-                        if (attrs[a] != null) {
-                            fail(e1.toString());
-                        }
-                    } catch (IllegalArgumentException e) {
-                        if (services[i]
-                                .isDocFlavorSupported(DocFlavor.INPUT_STREAM.GIF)) {
-                            fail(e.toString());
-                        }
-                    } catch (Exception e) {
+            Attribute[] attrs = { MediaSizeName.ISO_A0,
+                    Finishings.NONE,
+                    Finishings.EDGE_STITCH,
+                    MediaSizeName.ISO_A2,
+                    MediaSizeName.ISO_A3,
+                    new Destination(uri1),
+                    new Destination(uri2),
+                    new Destination(uri3),
+                    new DocumentName("xyz", Locale.US),
+                    new JobName("xyz", Locale.US),
+                    new RequestingUserName("xyz", Locale.US),
+                    Sides.DUPLEX,
+                    Sides.ONE_SIDED,
+                    Sides.TUMBLE,
+                    Sides.TWO_SIDED_LONG_EDGE,
+                    Sides.TWO_SIDED_SHORT_EDGE,
+                    null };
+            for (int a = 0, ac = attrs.length; a < ac; a++) {
+                try {
+                    supported = services[i].isAttributeValueSupported(
+                            attrs[a], DocFlavor.INPUT_STREAM.GIF, null);
+                } catch (NullPointerException e1) {
+                    if (attrs[a] != null) {
+                        fail(e1.toString());
+                    }
+                } catch (IllegalArgumentException e) {
+                    if (services[i]
+                            .isDocFlavorSupported(DocFlavor.INPUT_STREAM.GIF)) {
                         fail(e.toString());
                     }
-                    System.out.println(attrs[a]
-
-                            + (attrs[a] == null ? "" : "("
-                                    + attrs[a].getCategory().toString() + ")")
-                            + " : " + supported);
+                } catch (Exception e) {
+                    fail(e.toString());
                 }
-            } catch (Exception e) {
-                fail(e.toString());
+                System.out.println(attrs[a]
+
+                        + (attrs[a] == null ? "" : "("
+                                + attrs[a].getCategory().toString() + ")")
+                        + " : " + supported);
             }
         }
 
-        System.out
-                .println("============= END testIsAttributeValueSupported ================");
+        System.out.println("============= END testIsAttributeValueSupported ================");
     }
 
 }

Modified: harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/LookupDefaultPrintServiceTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/LookupDefaultPrintServiceTest.java?rev=589730&r1=589729&r2=589730&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/LookupDefaultPrintServiceTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/LookupDefaultPrintServiceTest.java
Mon Oct 29 09:49:01 2007
@@ -34,7 +34,7 @@
 import junit.framework.TestCase;
 
 public class LookupDefaultPrintServiceTest extends TestCase {
-    public void testLookupDefaultPrintService() {
+    public void testLookupDefaultPrintService() throws Exception {
         System.out
                 .println("======= START LookupDefaultPrintServiceTest ======");
 
@@ -51,29 +51,24 @@
         daset.add(MediaName.ISO_A4_WHITE);
         daset.add(Sides.TWO_SIDED_LONG_EDGE);
 
-        try {
-            service = PrintServiceLookup.lookupDefaultPrintService();
-            if (service != null) {
-                if (service.isDocFlavorSupported(psFlavor)) {
-                    if (service.getUnsupportedAttributes(psFlavor, aset)==null) {
-                        fis = this.getClass().getResourceAsStream(
-                                "/Resources/GIF.gif");
-                        doc = new SimpleDoc(fis, psFlavor, daset);
+        service = PrintServiceLookup.lookupDefaultPrintService();
+        if (service != null) {
+            if (service.isDocFlavorSupported(psFlavor)) {
+                if (service.getUnsupportedAttributes(psFlavor, aset)==null) {
+                    fis = this.getClass().getResourceAsStream(
+                            "/Resources/GIF.gif");
+                    doc = new SimpleDoc(fis, psFlavor, daset);
 
-                        pj = service.createPrintJob();
-                        pj.print(doc, aset);
-                        System.out.println(fis.toString() + " printed on "
-                                + service.getName());
-                    }
-                } else {
-                    System.out.println("flavor is not supported");
+                    pj = service.createPrintJob();
+                    pj.print(doc, aset);
+                    System.out.println(fis.toString() + " printed on "
+                            + service.getName());
                 }
             } else {
-                System.out.println("service not found");
+                System.out.println("flavor is not supported");
             }
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
+        } else {
+            System.out.println("service not found");
         }
 
         System.out.println("======= END LookupDefaultPrintServiceTest =======");

Modified: harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/LookupMultiDocPrintServicesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/LookupMultiDocPrintServicesTest.java?rev=589730&r1=589729&r2=589730&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/LookupMultiDocPrintServicesTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/LookupMultiDocPrintServicesTest.java
Mon Oct 29 09:49:01 2007
@@ -34,7 +34,7 @@
 import junit.framework.TestCase;
 
 public class LookupMultiDocPrintServicesTest extends TestCase {
-    public void testLookupMultiDocPrintServices() {
+    public void testLookupMultiDocPrintServices() throws Exception {
         System.out
                 .println("============= START LookupMultiDocPrintServicesTest ================");
 
@@ -51,27 +51,21 @@
         daset.add(MediaName.ISO_A4_WHITE);
         daset.add(Sides.TWO_SIDED_LONG_EDGE);
 
-        try {
-            services = PrintServiceLookup.lookupMultiDocPrintServices(
-                    new DocFlavor[] { psFlavor }, aset);
-            if (services != null && services.length > 0) {
-                fis = new FileInputStream("/Resources/1M.GIF");
-                doc = new SimpleDoc(fis, psFlavor, daset);
+        services = PrintServiceLookup.lookupMultiDocPrintServices(
+                new DocFlavor[] { psFlavor }, aset);
+        if (services != null && services.length > 0) {
+            fis = new FileInputStream("/Resources/1M.GIF");
+            doc = new SimpleDoc(fis, psFlavor, daset);
 
-                pj = services[0].createPrintJob();
-                pj.print(doc, aset);
-                System.out.println(fis.toString() + " printed on "
-                        + services[0].getName());
-            } else {
-                System.out.println("services not found");
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
+            pj = services[0].createPrintJob();
+            pj.print(doc, aset);
+            System.out.println(fis.toString() + " printed on "
+                    + services[0].getName());
+        } else {
+            System.out.println("services not found");
         }
 
-        System.out
-                .println("============= END LookupMultiDocPrintServicesTest ================");
+        System.out.println("============= END LookupMultiDocPrintServicesTest ================");
     }
 
 }

Modified: harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/LookupPrintServicesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/LookupPrintServicesTest.java?rev=589730&r1=589729&r2=589730&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/LookupPrintServicesTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/LookupPrintServicesTest.java
Mon Oct 29 09:49:01 2007
@@ -29,7 +29,7 @@
 import junit.framework.TestCase;
 
 public class LookupPrintServicesTest extends TestCase {
-    public void testLookupPrintServices() {
+    public void testLookupPrintServices() throws Exception {
         System.out.println("======== START LookupPrintServicesTest ========");
 
         PrintService[] services;
@@ -41,31 +41,27 @@
         Object[][] filetoprint = { { "/Resources/JPEG.jpg",
                 DocFlavor.INPUT_STREAM.JPEG },
                 { "/Resources/GIF.gif", DocFlavor.INPUT_STREAM.GIF } };
-        try {
-            DocFlavor df;
-            InputStream fis;
-
-            for (int i = 0; i < filetoprint.length; i++) {
-                df = (DocFlavor) filetoprint[i][1];
-
-                services = PrintServiceLookup.lookupPrintServices(df, aset);
-                TestUtil.checkServices(services);
-
-                for (int j = 0; j < services.length; j++) {
-                    fis = this.getClass().getResourceAsStream(
-                            (String) filetoprint[i][0]);
-                    doc = new SimpleDoc(fis, df, daset);
-                    PrintService printer = services[j];
-
-                    pj = printer.createPrintJob();
-                    pj.print(doc, aset);
-                    System.out.println(fis.toString() + " printed on "
-                            + printer.getName());
-                }
+
+        DocFlavor df;
+        InputStream fis;
+
+        for (int i = 0; i < filetoprint.length; i++) {
+            df = (DocFlavor) filetoprint[i][1];
+
+            services = PrintServiceLookup.lookupPrintServices(df, aset);
+            TestUtil.checkServices(services);
+
+            for (int j = 0; j < services.length; j++) {
+                fis = this.getClass().getResourceAsStream(
+                        (String) filetoprint[i][0]);
+                doc = new SimpleDoc(fis, df, daset);
+                PrintService printer = services[j];
+
+                pj = printer.createPrintJob();
+                pj.print(doc, aset);
+                System.out.println(fis.toString() + " printed on "
+                        + printer.getName());
             }
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
         }
 
         System.out.println("====== END LookupPrintServicesTest ========");

Modified: harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/PrintAutosenseTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/PrintAutosenseTest.java?rev=589730&r1=589729&r2=589730&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/PrintAutosenseTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/PrintAutosenseTest.java
Mon Oct 29 09:49:01 2007
@@ -29,11 +29,11 @@
 import junit.framework.TestCase;
 
 public class PrintAutosenseTest extends TestCase {
-    public static void main(String[] args) {
+    public static void main(String[] args) throws Exception {
         new PrintAutosenseTest().testPrintAutosense();
     }
 
-    public void testPrintAutosense() {
+    public void testPrintAutosense() throws Exception {
         System.out.println("======== START PrintAutosenseTest ========");
 
         PrintService[] services;
@@ -43,28 +43,23 @@
 
         daset.add(MediaSizeName.ISO_A4);
 
-        try {
-            DocFlavor df = DocFlavor.INPUT_STREAM.AUTOSENSE;
-            InputStream fis = this.getClass().getResourceAsStream(
-                    "/Resources/hello_ps.ps");
-            services = PrintServiceLookup.lookupPrintServices(df, null);
-            TestUtil.checkServices(services);
-
-            for (int j = 0; j < services.length; j++) {
-                PrintService printer = services[j];
-                if (printer.toString().indexOf("print-to-file") >= 0) {
-                    doc = new SimpleDoc(fis, df, null);
-
-                    pj = printer.createPrintJob();
-                    pj.print(doc, null);
-                    System.out.println(fis.toString() + " printed on "
-                            + printer.getName());
-                    break;
-                }
+        DocFlavor df = DocFlavor.INPUT_STREAM.AUTOSENSE;
+        InputStream fis = this.getClass().getResourceAsStream(
+                "/Resources/hello_ps.ps");
+        services = PrintServiceLookup.lookupPrintServices(df, null);
+        TestUtil.checkServices(services);
+
+        for (int j = 0; j < services.length; j++) {
+            PrintService printer = services[j];
+            if (printer.toString().indexOf("print-to-file") >= 0) {
+                doc = new SimpleDoc(fis, df, null);
+
+                pj = printer.createPrintJob();
+                pj.print(doc, null);
+                System.out.println(fis.toString() + " printed on "
+                        + printer.getName());
+                break;
             }
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
         }
 
         System.out.println("====== END PrintAutosenseTest ========");

Modified: harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/PrintJpegTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/PrintJpegTest.java?rev=589730&r1=589729&r2=589730&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/PrintJpegTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/PrintJpegTest.java
Mon Oct 29 09:49:01 2007
@@ -31,11 +31,11 @@
 import junit.framework.TestCase;
 
 public class PrintJpegTest extends TestCase {
-    public static void main(String[] args) {
+    public static void main(String[] args) throws Exception {
         new PrintJpegTest().testPrintJpeg();
     }
     
-    public void testPrintJpeg() {
+    public void testPrintJpeg() throws Exception {
         System.out.println("======== START PrintJpegTest ========");
 
         PrintService[] services;
@@ -46,28 +46,23 @@
 
         daset.add(MediaSizeName.ISO_A4);
 
-        try {
-            DocFlavor df = DocFlavor.INPUT_STREAM.JPEG;
-            InputStream fis = this.getClass().getResourceAsStream(
-                    "/Resources/JPEG.jpg");
-            services = PrintServiceLookup.lookupPrintServices(df, aset);
-            TestUtil.checkServices(services);
+        DocFlavor df = DocFlavor.INPUT_STREAM.JPEG;
+        InputStream fis = this.getClass().getResourceAsStream(
+                "/Resources/JPEG.jpg");
+        services = PrintServiceLookup.lookupPrintServices(df, aset);
+        TestUtil.checkServices(services);
 
-            for (int j = 0; j < services.length; j++) {
-                PrintService printer = services[j];
-                if (printer.toString().indexOf("print-to-file") >= 0) {
-                    doc = new SimpleDoc(fis, df, daset);
+        for (int j = 0; j < services.length; j++) {
+            PrintService printer = services[j];
+            if (printer.toString().indexOf("print-to-file") >= 0) {
+                doc = new SimpleDoc(fis, df, daset);
 
-                    pj = printer.createPrintJob();
-                    pj.print(doc, aset);
-                    System.out.println(fis.toString() + " printed on "
-                            + printer.getName());
-                    break;
-                }
+                pj = printer.createPrintJob();
+                pj.print(doc, aset);
+                System.out.println(fis.toString() + " printed on "
+                        + printer.getName());
+                break;
             }
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
         }
 
         System.out.println("====== END PrintJpegTest ========");

Modified: harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/ValueTests.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/ValueTests.java?rev=589730&r1=589729&r2=589730&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/ValueTests.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/ValueTests.java
Mon Oct 29 09:49:01 2007
@@ -228,7 +228,7 @@
     assertTrue(streamService.isDisposed());
 }
 
-public void testStreamServicePrinting() {
+public void testStreamServicePrinting() throws Exception {
     startTest("StreamPrintServiceFactory class testing...");
     
     byte [] forChecking = {'%', '!', 'P', 'S', '-', 'A', 'd', 'o', 'b', 'e'};
@@ -256,12 +256,9 @@
     streamService = streamFactory.getPrintService(new ByteArrayOutputStream());
     aJob = streamService.createPrintJob();
     doc = new SimpleDoc(aStream, flavor, null);
-    try {
-        aJob.print(doc, null);
-    } catch (Exception e) {
-        e.printStackTrace();
-        fail("Can not print PrintJob!");
-    }    
+
+    aJob.print(doc, null);
+
     arr = ((ByteArrayOutputStream) (streamService.getOutputStream()))
             .toByteArray();
     for (int i = 0; i < 10; i++) {

Modified: harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/AttributeSetUtilitiesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/AttributeSetUtilitiesTest.java?rev=589730&r1=589729&r2=589730&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/AttributeSetUtilitiesTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/AttributeSetUtilitiesTest.java
Mon Oct 29 09:49:01 2007
@@ -48,15 +48,10 @@
      * if arguments are valid.
      */
     public final void testVerifyAttributeCategory() {
-
-        try {
-            assertEquals(ColorSupported.class,
-                AttributeSetUtilities.
-                    verifyAttributeCategory(ColorSupported.class,
-                        PrintServiceAttribute.class));
-        } catch (Exception e) {
-            fail("Unexpected was thrown: " + e.toString());
-        }
+        assertEquals(ColorSupported.class,
+            AttributeSetUtilities.
+                verifyAttributeCategory(ColorSupported.class,
+                    PrintServiceAttribute.class));
     }
 
     /*
@@ -125,19 +120,13 @@
      * exception is thown if arguments are valid.
      */
     public final void testVerifyAttributeValue() {
-
-        try {
-            PrintJobAttribute att = new Copies(10);
-            assertEquals(att,
+        PrintJobAttribute att = new Copies(10);
+        assertEquals(att,
+            AttributeSetUtilities.
+                verifyAttributeValue(att, PrintJobAttribute.class));
+        assertEquals(att,
                 AttributeSetUtilities.
-                    verifyAttributeValue(att, PrintJobAttribute.class));
-            assertEquals(att,
-                    AttributeSetUtilities.
-                        verifyAttributeValue(att, PrintRequestAttribute.class));
-        } catch (Exception e) {
-            fail("Unexpected was thrown: " + e.toString());
-        }
-
+                    verifyAttributeValue(att, PrintRequestAttribute.class));
     }
 
     /*
@@ -177,14 +166,9 @@
      * Tests that method throws no exception if arguments are valid.
      */
     public final void testVerifyCategoryForValue() {
-
-        try {
-            PrintServiceAttribute att = ColorSupported.NOT_SUPPORTED;
-            AttributeSetUtilities.
-                verifyCategoryForValue(ColorSupported.class, att);
-        } catch (Exception e) {
-            fail("Unexpected was thrown: " + e.toString());
-        }
+        PrintServiceAttribute att = ColorSupported.NOT_SUPPORTED;
+        AttributeSetUtilities.
+            verifyCategoryForValue(ColorSupported.class, att);
     }
 
     /*

Modified: harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/EnumSyntaxTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/EnumSyntaxTest.java?rev=589730&r1=589729&r2=589730&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/EnumSyntaxTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/EnumSyntaxTest.java
Mon Oct 29 09:49:01 2007
@@ -150,14 +150,10 @@
      * value toString() returns string contains this enumeration value.
      */
     public void testToString() {
-        try {
-            ees = new ExtendEnumSyntax(2);
-            assertEquals("2", ees.toString());
-            es = new enumSyntax(10);
-            assertEquals("10", es.toString());
-        } catch (Exception e) {
-            fail("toString() throws an exception");
-        }
+        ees = new ExtendEnumSyntax(2);
+        assertEquals("2", ees.toString());
+        es = new enumSyntax(10);
+        assertEquals("10", es.toString());
     }
 
     /*

Modified: harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/HashAttributeTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/HashAttributeTest.java?rev=589730&r1=589729&r2=589730&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/HashAttributeTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/HashAttributeTest.java
Mon Oct 29 09:49:01 2007
@@ -65,12 +65,8 @@
                     "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());
-        }
+        AttributeSet aset1 = null;
+        AttributeSet aset2 = new HashAttributeSet(aset1);
     }
 
 

Modified: harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/SetOfIntegerSyntaxTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/SetOfIntegerSyntaxTest.java?rev=589730&r1=589729&r2=589730&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/SetOfIntegerSyntaxTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/SetOfIntegerSyntaxTest.java
Mon Oct 29 09:49:01 2007
@@ -45,17 +45,13 @@
      * 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());
-        }
+        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("");
 
         try {
             set1 = new setOfIntegerSyntax("17-50 1000-160");
@@ -160,15 +156,12 @@
             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[][] {{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]);
 
         arr1 = new int[][] {{15,14}};
         set1 = new setOfIntegerSyntax(arr1);

Modified: harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/URISyntaxTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/URISyntaxTest.java?rev=589730&r1=589729&r2=589730&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/URISyntaxTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/URISyntaxTest.java
Mon Oct 29 09:49:01 2007
@@ -43,13 +43,10 @@
     /*
      * 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);
-        }
+    public final void testURISyntax() throws Exception {
+        uri1 = new URI("http://news.ngs.ru/more/14161.shtml");
+        us1 = new uriSyntax(uri1);
+
         try {
             uri1 = null;
             us1 = new uriSyntax(uri1);
@@ -62,60 +59,44 @@
     /*
      * 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);
-        }
-
+    public final void testHashCode() throws Exception {
+        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());
     }
 
     /*
      * 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);
-        }
+    public final void testEqualsObject() throws Exception {
+        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));
     }
 
     /*
      * 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);
-        }
+    public final void testGetURI() throws Exception {
+        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());
     }
 
 

Modified: harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/standard/MediaTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/standard/MediaTest.java?rev=589730&r1=589729&r2=589730&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/standard/MediaTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/print/src/test/api/java/common/javax/print/attribute/standard/MediaTest.java
Mon Oct 29 09:49:01 2007
@@ -48,12 +48,8 @@
         Media tray = new mediaTray(1);
         assertFalse(name.equals(tray));
 
-        try {
-            sizename = null;
-            assertFalse(name.equals(sizename));
-        } catch (Exception e) {
-            fail("Unexpected exception ocurred " + e);
-        }
+        sizename = null;
+        assertFalse(name.equals(sizename));
     }
 
     /*



Mime
View raw message