< prev index next >

test/javax/xml/jaxp/unittest/transform/util/SAXUtil.java

Print this page




  53     public Source prepareSource(InputStream is) throws Exception {
  54         return new SAXSource(new InputSource(is));
  55     }
  56 
  57     public Result prepareResult() throws Exception {
  58         VersionDefaultHandler dh = new VersionDefaultHandler();
  59         return new SAXResult(dh);
  60     }
  61 
  62     public void checkResult(Result result, String inputVersion) throws Exception {
  63         String version = ((VersionDefaultHandler) ((SAXResult) result).getHandler()).getVersion();
  64         Assert.assertTrue(inputVersion.equals(version), "Expected XML Version is 1.1, but actual version " + version);
  65     }
  66 
  67     public void checkResult(Result result, String inputVersion, String encoding) throws Exception {
  68         checkResult(result, inputVersion);
  69         String resultEncoding = ((VersionDefaultHandler) ((SAXResult) result).getHandler()).getEncoding();
  70         Assert.assertTrue(encoding.equals(resultEncoding), "Expected XML Version is " + encoding + " , but actual  encoding " + resultEncoding);
  71     }
  72 }
  73 


  53     public Source prepareSource(InputStream is) throws Exception {
  54         return new SAXSource(new InputSource(is));
  55     }
  56 
  57     public Result prepareResult() throws Exception {
  58         VersionDefaultHandler dh = new VersionDefaultHandler();
  59         return new SAXResult(dh);
  60     }
  61 
  62     public void checkResult(Result result, String inputVersion) throws Exception {
  63         String version = ((VersionDefaultHandler) ((SAXResult) result).getHandler()).getVersion();
  64         Assert.assertTrue(inputVersion.equals(version), "Expected XML Version is 1.1, but actual version " + version);
  65     }
  66 
  67     public void checkResult(Result result, String inputVersion, String encoding) throws Exception {
  68         checkResult(result, inputVersion);
  69         String resultEncoding = ((VersionDefaultHandler) ((SAXResult) result).getHandler()).getEncoding();
  70         Assert.assertTrue(encoding.equals(resultEncoding), "Expected XML Version is " + encoding + " , but actual  encoding " + resultEncoding);
  71     }
  72 }

< prev index next >