1 30 package org.objectweb.asm.xml; 31 32 import org.xml.sax.Attributes ; 33 import org.xml.sax.SAXException ; 34 import org.xml.sax.helpers.DefaultHandler ; 35 36 import junit.framework.TestCase; 37 38 43 public class SAXAdapterUnitTest extends TestCase { 44 45 SAXAdapter sa; 46 47 protected void setUp() { 48 sa = new SAXAdapter(new DefaultHandler () { 49 50 public void startDocument() throws SAXException { 51 throw new SAXException (); 52 } 53 54 public void endDocument() throws SAXException { 55 throw new SAXException (); 56 } 57 58 public void startElement( 59 final String arg0, 60 final String arg1, 61 final String arg2, 62 final Attributes arg3) throws SAXException 63 { 64 throw new SAXException (); 65 } 66 67 public void endElement( 68 final String arg0, 69 final String arg1, 70 final String arg2) throws SAXException 71 { 72 throw new SAXException (); 73 } 74 }) 75 { 76 }; 77 } 78 79 public void testInvalidAddDocumentStart() { 80 try { 81 sa.addDocumentStart(); 82 fail(); 83 } catch (Exception e) { 84 } 85 } 86 87 public void testInvalidAddDocumentEnd() { 88 try { 89 sa.addDocumentEnd(); 90 fail(); 91 } catch (Exception e) { 92 } 93 } 94 95 public void testInvalidAddStart() { 96 try { 97 sa.addStart("name", null); 98 fail(); 99 } catch (Exception e) { 100 } 101 } 102 103 public void testInvalidAddEnd() { 104 try { 105 sa.addEnd("name"); 106 fail(); 107 } catch (Exception e) { 108 } 109 } 110 } 111 | Popular Tags |