|
From: <fb...@us...> - 2003-06-27 14:45:13
|
Update of /cvsroot/jgb/jgb/src/java/tests/jgb/handlers/swing
In directory sc8-pr-cvs1:/tmp/cvs-serv27972/src/java/tests/jgb/handlers/swing
Modified Files:
TestNullTagHandler.java
Log Message:
* src/java/tests/jgb/handlers/swing/TestNullTagHandler.java:
Imported test created by Steven Oglesby.
Added test to confirm endElement() is a NOOP.
Index: TestNullTagHandler.java
===================================================================
RCS file: /cvsroot/jgb/jgb/src/java/tests/jgb/handlers/swing/TestNullTagHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** TestNullTagHandler.java 25 Jun 2003 20:40:25 -0000 1.1
--- TestNullTagHandler.java 27 Jun 2003 14:45:09 -0000 1.2
***************
*** 25,28 ****
--- 25,32 ----
import org.xml.sax.SAXException;
+ import java.util.Map;
+ import java.util.HashMap;
+ import java.util.Collections;
+
public class TestNullTagHandler extends TagHandlerAbstractTest {
public TestNullTagHandler(String s) {
***************
*** 43,49 ****
public void testEndElement() throws Exception {
! pass();
}
protected TagHandler createHandler() {
--- 47,74 ----
public void testEndElement() throws Exception {
! final Map oldContext = Collections.unmodifiableMap(new HashMap(context));
!
! handler.endElement("null", context);
!
! assertEquals(oldContext, context);
}
+ public void testStartElement_InvalidClass() throws SAXException {
+ String invalidClassName = "jgb.invalid.Class";
+ atts.put("class", invalidClassName);
+
+ final Map oldContext = Collections.unmodifiableMap(new HashMap(context));
+
+ try {
+ handler.startElement("null", context, atts);
+ } catch (SAXException possibleSuccess) {
+ assertEquals(ClassNotFoundException.class,
+ possibleSuccess.getException().getClass());
+ assertTrue("exception message names the unfound class",
+ -1 != possibleSuccess.getMessage().indexOf(invalidClassName));
+ }
+
+ assertEquals(oldContext, context);
+ }
protected TagHandler createHandler() {
|