use of cn.hutool.core.lang.Dict in project hutool by looly.
the class DictTest method dictTest.
@Test
public void dictTest() {
Dict dict = Dict.create().set("key1", // int
1).set("key2", // long
1000L).set("key3", // Date
DateTime.now());
Long v2 = dict.getLong("key2");
Assert.assertEquals(Long.valueOf(1000L), v2);
}
use of cn.hutool.core.lang.Dict in project hutool by looly.
the class ExpressionUtilTest method jexlTest.
@Test
public void jexlTest() {
ExpressionEngine engine = new JexlEngine();
final Dict dict = Dict.create().set("a", 100.3).set("b", 45).set("c", -199.100);
final Object eval = engine.eval("a-(b-c)", dict);
Assert.assertEquals(-143.8, (double) eval, 2);
}
use of cn.hutool.core.lang.Dict in project hutool by looly.
the class ExpressionUtilTest method rhinoTest.
@Test
public void rhinoTest() {
ExpressionEngine engine = new RhinoEngine();
final Dict dict = Dict.create().set("a", 100.3).set("b", 45).set("c", -199.100);
final Object eval = engine.eval("a-(b-c)", dict);
Assert.assertEquals(-143.8, (double) eval, 2);
}
use of cn.hutool.core.lang.Dict in project hutool by looly.
the class ExpressionUtilTest method mvelTest.
@Test
public void mvelTest() {
ExpressionEngine engine = new MvelEngine();
final Dict dict = Dict.create().set("a", 100.3).set("b", 45).set("c", -199.100);
final Object eval = engine.eval("a-(b-c)", dict);
Assert.assertEquals(-143.8, (double) eval, 2);
}
use of cn.hutool.core.lang.Dict in project hutool by looly.
the class ExpressionUtilTest method spELTest.
@Test
public void spELTest() {
ExpressionEngine engine = new SpELEngine();
final Dict dict = Dict.create().set("a", 100.3).set("b", 45).set("c", -199.100);
final Object eval = engine.eval("#a-(#b-#c)", dict);
Assert.assertEquals(-143.8, (double) eval, 2);
}
Aggregations