package org.apache.ibatis.parsing;

import org.apache.ibatis.io.Resources;
import static org.junit.Assert.assertEquals;
import org.junit.Test;

import java.io.Reader;

public class XPathParserTest {

  @Test
  public void shouldTestXPathParserMethods() throws Exception {
    String resource = "resources/nodelet_test.xml";
    Reader reader = Resources.getResourceAsReader(resource);
    XPathParser parser = new XPathParser(reader, false, null, null);
    assertEquals((long)1970, parser.evalLong("/employee/birth_date/year"));
    assertEquals((short)6, parser.evalShort("/employee/birth_date/month"));
    assertEquals(15, parser.evalInteger("/employee/birth_date/day"));
    assertEquals(5.8f, parser.evalFloat("/employee/height"));
    assertEquals(5.8d, parser.evalDouble("/employee/height"));
    assertEquals("${id_var}", parser.evalString("/employee/@id"));
    assertEquals(Boolean.TRUE, parser.evalBoolean("/employee/active"));
    assertEquals("<id>${id_var}</id>", parser.evalNode("/employee/@id").toString().trim());
    assertEquals(7, parser.evalNodes("/employee/*").size());
    XNode node = parser.evalNode("/employee/height");
    assertEquals("employee/height", node.getPath());
    assertEquals("employee[${id_var}]_height", node.getValueBasedIdentifier());
  }

}

@@ -484,17 +484,17 @@
 ls((
-l
+L
 ong)1970
 , pa
@@ -489,16 +489,17 @@
 ong)1970
+l
 , parser
@@ -568,10 +568,19 @@
 ort)
+ 
 6,
+ (short)
  par
@@ -643,16 +643,26 @@
 tEquals(
+(Integer) 
 15, pars
@@ -724,16 +724,24 @@
 tEquals(
+(Float) 
 5.8f, pa
@@ -795,16 +795,25 @@
 tEquals(
+(Double) 
 5.8d, pa

Fix test so that it works with Junit 4.6