Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 61 62 package org.jaxen; 63 64 65 import junit.framework.TestCase; 66 import org.jaxen.dom.*; 67 68 72 public class XPathSyntaxExceptionTest extends TestCase { 73 74 public XPathSyntaxExceptionTest(String name) { 75 super(name); 76 } 77 78 public void testGetXPath() throws JaxenException { 79 80 try { 81 new DOMXPath("///triple slash"); 82 fail("Bad parsing"); 83 } 84 catch (XPathSyntaxException ex) { 85 assertEquals("///triple slash", ex.getXPath()); 86 } 87 88 } 89 90 public void testGetPositionMarker() throws JaxenException { 91 92 try { 93 new DOMXPath("///triple slash"); 94 fail("Bad parsing"); 95 } 96 catch (XPathSyntaxException ex) { 97 assertTrue(ex.getPositionMarker().startsWith(" ")); 98 assertTrue(ex.getPositionMarker().endsWith("^")); 99 } 100 101 } 102 103 public void testGetMultilineMessage() throws JaxenException { 104 105 try { 106 new DOMXPath("///triple slash"); 107 fail("Bad parsing"); 108 } 109 catch (XPathSyntaxException ex) { 110 String message = ex.getMultilineMessage(); 111 assertTrue(message.indexOf("\n///triple slash\n") > 1); 112 assertTrue(message.endsWith("^")); 113 } 114 115 } 116 117 } 118
| Popular Tags
|