Package org.jaxen

Examples of org.jaxen.BaseXPath.evaluate()


    public void testEvaluateWithMultiNodeAnswer() throws JaxenException {
       
        BaseXPath xpath = new DOMXPath("(/descendant-or-self::node())");
       
        doc.appendChild(doc.createElement("root"));
        List result = (List) xpath.evaluate(doc);
        assertEquals(2, result.size());
       
    }
   
   
View Full Code Here


 
    public void testStringLengthFunctionOperatesOnContextNode()
      throws JaxenException {
       
        BaseXPath xpath = new DOMXPath("string-length()");
        Double result = (Double) xpath.evaluate( doc );
        assertEquals(0, result.intValue());
       
    }   

    public void testStringLengthFunctionCountsUnicodeCharactersNotJavaChars()
View Full Code Here

    public void testStringLengthFunctionCountsUnicodeCharactersNotJavaChars()
      throws JaxenException {
  
        BaseXPath xpath = new DOMXPath("string-length('\uD834\uDD00')");
        Double result = (Double) xpath.evaluate( doc );
        assertEquals(1, result.intValue());
       
    }   

    public void testStringLengthFunctionWithMalformedString()
View Full Code Here

    public void testStringLengthFunctionWithMalformedString()
      throws JaxenException {
  
        BaseXPath xpath = new DOMXPath("string-length('\uD834A\uDD00')");
        try {
            xpath.evaluate( doc );
            fail("Allowed Malformed string");
        }
        catch (FunctionCallException ex) {
            assertNotNull(ex.getMessage());
        }
View Full Code Here

    protected void assertValueOfXPath(String expected, Object context, String xpathStr) throws JaxenException
    {
        try
        {
            BaseXPath xpath = new BaseXPath(xpathStr, getNavigator());
            Object node = xpath.evaluate(getContext(context));
            String result = StringFunction.evaluate(node,
                    getNavigator());
            log(debug,
                    "  Select :: " + xpathStr);
            log(debug,
View Full Code Here

    public void testFloor() throws JaxenException {
       
        BaseXPath xpath = new DOMXPath("floor(1.5)");
       
        Object result = xpath.evaluate(doc);
        assertEquals(1, ((Double) result).doubleValue(), 0.0001);
       
    }   

    public void testNegativeFloor() throws JaxenException {
View Full Code Here

    public void testNegativeFloor() throws JaxenException {
       
        BaseXPath xpath = new DOMXPath("floor(-1.5)");
       
        Object result = xpath.evaluate(doc);
        assertEquals(-2, ((Double) result).doubleValue(), 0.0001);
       
    }   

    public void testNaNFloorIsNaN() throws JaxenException {
View Full Code Here

       
    }   

    public void testNaNFloorIsNaN() throws JaxenException {
        BaseXPath xpath = new DOMXPath("floor(1.0 div 0.0 - 2.0 div 0.0)");
        double result = ((Double) xpath.evaluate(doc)).doubleValue();
        assertTrue(Double.isNaN(result));
    }   

    public void testInfFloorIsInf() throws JaxenException {
        BaseXPath xpath = new DOMXPath("floor(1.0 div 0.0)");
View Full Code Here

        assertTrue(Double.isNaN(result));
    }   

    public void testInfFloorIsInf() throws JaxenException {
        BaseXPath xpath = new DOMXPath("floor(1.0 div 0.0)");
        double result = ((Double) xpath.evaluate(doc)).doubleValue();
        assertTrue(Double.isInfinite(result));
        assertTrue(result > 0);
    }   

    public void testNegativeInfFloorIsNegativeInf() throws JaxenException {
View Full Code Here

        assertTrue(result > 0);
    }   

    public void testNegativeInfFloorIsNegativeInf() throws JaxenException {
        BaseXPath xpath = new DOMXPath("floor(-1.0 div 0.0)");
        double result = ((Double) xpath.evaluate(doc)).doubleValue();
        assertTrue(Double.isInfinite(result));
        assertTrue(result < 0);
    }   

    public void testFloorFunctionRequiresAtLeastArgument()
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.