use of org.seimicrawler.xpath.core.XValue in project JsoupXpath by zhegexiaohuozi.
the class DateFormatTest method localTest.
@Test
public void localTest() {
List<XValue> params = new LinkedList<>();
params.add(XValue.create("1/21/2019 07:05:42 AM"));
params.add(XValue.create("MM/dd/yyyy hh:mm:ss aa"));
params.add(XValue.create(Locale.ENGLISH.toString()));
FormatDate formatDate = new FormatDate();
XValue value = formatDate.call(null, params);
System.out.println(value.asDate());
}
use of org.seimicrawler.xpath.core.XValue in project JsoupXpath by zhegexiaohuozi.
the class DateFormatTest method defaultTest.
@Test
public void defaultTest() {
List<XValue> params = new LinkedList<>();
params.add(XValue.create("2019-01-21 19:05:42"));
params.add(XValue.create("yyyy-MM-dd HH:mm:ss"));
FormatDate formatDate = new FormatDate();
XValue value = formatDate.call(null, params);
System.out.println(value.asDate());
}
use of org.seimicrawler.xpath.core.XValue in project JsoupXpath by zhegexiaohuozi.
the class NumTest method testOnZero.
@Test
public void testOnZero() throws Exception {
Elements context = new Elements();
Element el = new Element("V");
el.appendText("test 69.");
context.add(el);
Num n = new Num();
XValue v = n.call(Scope.create(context));
logger.info("v = {}", v);
Assert.assertEquals(69, v.asDouble(), 0.00000000000001);
}
use of org.seimicrawler.xpath.core.XValue in project JsoupXpath by zhegexiaohuozi.
the class NumTest method testShort.
@Test
public void testShort() throws Exception {
Elements context = new Elements();
Element el = new Element("V");
el.appendText("test .69");
context.add(el);
Num n = new Num();
XValue v = n.call(Scope.create(context));
logger.info("v = {}", v);
Assert.assertEquals(0.69, v.asDouble(), 0.00000000000001);
}
use of org.seimicrawler.xpath.core.XValue in project JsoupXpath by zhegexiaohuozi.
the class NumTest method testCall.
/**
* Method: call(Elements context)
*/
@Test
public void testCall() throws Exception {
Elements context = new Elements();
Element el = new Element("V");
el.appendText("test 33.69");
context.add(el);
Num n = new Num();
XValue v = n.call(Scope.create(context));
logger.info("v = {}", v);
Assert.assertEquals(33.69, v.asDouble(), 0.00000000000001);
}
Aggregations