1 19 package org.enhydra.zeus.binder; 20 21 import java.io.File ; 22 import java.io.FileInputStream ; 23 import java.io.FileNotFoundException ; 24 import java.io.InputStream ; 25 import java.io.InputStreamReader ; 26 import java.io.IOException ; 27 import java.io.Reader ; 28 import java.io.StringReader ; 29 import java.util.List ; 30 31 import org.enhydra.zeus.source.StreamSource; 33 34 import junit.framework.Test; 36 import junit.framework.TestCase; 37 import junit.framework.TestSuite; 38 39 47 public class SchemaBinderTest extends TestCase { 48 49 58 public SchemaBinderTest(String testName) { 59 super(testName); 60 } 61 62 71 public static Test suite() { 72 return new TestSuite(SchemaBinderTest.class); 73 } 74 75 81 public void testConstructors() { 82 String systemID = "file:///test/system/ID.xml"; 83 FileInputStream in = null; 84 try { 85 in = new FileInputStream (new File ("bin/build.sh")); 86 } catch (FileNotFoundException neverHappens) { } 87 StreamSource ss = new StreamSource(in, systemID); 88 SchemaBinder binder = new SchemaBinder(ss); 89 90 ss = new StreamSource(in); 91 binder = new SchemaBinder(ss); 92 93 StringReader reader = new StringReader ("Test Input Reader"); 94 ss = new StreamSource(reader, systemID); 95 binder = new SchemaBinder(ss); 96 97 ss = new StreamSource(reader); 98 binder = new SchemaBinder(ss); 99 } 100 101 109 public void testGetBindingsNegative() { 110 boolean caught = false; 111 try { 112 String systemID = "file:///test/system/ID.dtd"; 113 FileInputStream in = null; 114 try { 115 in = new FileInputStream (new File ("bin/build.sh")); 116 } catch (FileNotFoundException neverHappens) { } 117 StreamSource ss = new StreamSource(in, systemID); 118 SchemaBinder binder = new SchemaBinder(ss); 119 List bindings = binder.getBindings(); 120 } catch (IOException e) { 121 caught = true; 123 } finally { 124 assertTrue(caught); 125 } 126 } 127 128 135 public void testGetBindingsPositive() { 136 } 139 } 140 | Popular Tags |