Author: sebb
Date: Wed Nov 30 16:46:51 2005
New Revision: 350088

URL: http://svn.apache.org/viewcvs?rev=350088&view=rev
Log:
Fix tests to fail if they don't fail when they should!

Modified:
    
jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java

Modified: 
jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java
URL: 
http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java?rev=350088&r1=350087&r2=350088&view=diff
==============================================================================
--- 
jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java
 (original)
+++ 
jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java
 Wed Nov 30 16:46:51 2005
@@ -59,6 +59,12 @@
             parserName = parser;

         }

 

+        private static class StaticTestClass // Can't instantiate

+        {

+            private StaticTestClass() {

+            };

+        }

+

         private class TestClass // Can't instantiate

         {

             private TestClass() {

@@ -129,6 +135,7 @@
             suite.addTest(new TestHTMLParser("testParserMissing"));

             suite.addTest(new TestHTMLParser("testNotParser"));

             suite.addTest(new TestHTMLParser("testNotCreatable"));

+            suite.addTest(new TestHTMLParser("testNotCreatableStatic"));

             for (int i = 0; i < PARSERS.length; i++) {

                 TestSuite ps = new TestSuite(PARSERS[i]);// Identify the

                                                             // subtests

@@ -165,6 +172,7 @@
         public void testParserMissing() throws Exception {

             try {

                 HTMLParser.getParser("no.such.parser");

+                fail("Should not have been able to create the parser");

             } catch (HTMLParseError e) {

                 if (e.getCause() instanceof ClassNotFoundException) {

                     // This is OK

@@ -177,6 +185,7 @@
         public void testNotParser() throws Exception {

             try {

                 HTMLParser.getParser("java.lang.String");

+                fail("Should not have been able to create the parser");

             } catch (HTMLParseError e) {

                 if (e.getCause() instanceof ClassCastException)

                     return;

@@ -187,8 +196,20 @@
         public void testNotCreatable() throws Exception {

             try {

                 HTMLParser.getParser(TestClass.class.getName());

+                fail("Should not have been able to create the parser");

             } catch (HTMLParseError e) {

                 if (e.getCause() instanceof InstantiationException)

+                    return;

+                throw e;

+            }

+        }

+

+        public void testNotCreatableStatic() throws Exception {

+            try {

+                HTMLParser.getParser(StaticTestClass.class.getName());

+                fail("Should not have been able to create the parser");

+            } catch (HTMLParseError e) {

+                if (e.getCause() instanceof ClassCastException)

                     return;

                 throw e;

             }




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to