1 61 62 63 64 package org.jaxen.expr; 65 66 import java.util.List ; 67 68 import javax.xml.parsers.DocumentBuilderFactory ; 69 import javax.xml.parsers.ParserConfigurationException ; 70 71 import org.jaxen.JaxenException; 72 import org.jaxen.dom.DOMXPath; 73 import org.w3c.dom.Document ; 74 import org.w3c.dom.Element ; 75 76 import junit.framework.TestCase; 77 78 87 public class ModTest extends TestCase 88 { 89 90 public void testModofNonIntegers() 91 throws JaxenException, ParserConfigurationException { 92 93 DOMXPath xpath = new DOMXPath("5.5 mod 2.5"); 94 95 DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); 96 factory.setNamespaceAware(true); 97 Document doc = factory.newDocumentBuilder().newDocument(); 98 Element root = doc.createElement("root"); 99 doc.appendChild(root); 100 101 Double result = (Double ) xpath.evaluate(doc); 102 assertEquals(0.5, result.doubleValue(), 0.000001); 103 104 } 105 106 } 107 | Popular Tags |