Search in sources :

Example 31 with Dict

use of cn.hutool.core.lang.Dict in project hutool by dromara.

the class YamlUtilTest method loadByPathTest.

@Test
public void loadByPathTest() {
    final Dict result = YamlUtil.loadByPath("test.yaml");
    Assert.assertEquals("John", result.getStr("firstName"));
    final List<Integer> numbers = result.getByPath("contactDetails.number");
    Assert.assertEquals(123456789, (int) numbers.get(0));
    Assert.assertEquals(456786868, (int) numbers.get(1));
}
Also used : Dict(cn.hutool.core.lang.Dict) Test(org.junit.Test)

Example 32 with Dict

use of cn.hutool.core.lang.Dict in project hutool by dromara.

the class YamlUtilTest method dumpTest.

@Test
@Ignore
public void dumpTest() {
    final Dict dict = Dict.create().set("name", "hutool").set("count", 1000);
    YamlUtil.dump(dict, FileUtil.getWriter("d:/test/dump.yaml", CharsetUtil.CHARSET_UTF_8, false));
}
Also used : Dict(cn.hutool.core.lang.Dict) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 33 with Dict

use of cn.hutool.core.lang.Dict in project SpringBoot-Learning by kong0827.

the class TestControllerTest method test.

@Test
public void test() throws InterruptedException {
    ExecutorService executorService = Executors.newFixedThreadPool(10);
    for (int i = 0; i < 30; i++) {
        executorService.submit(() -> {
            Dict dict = testController.test1();
            System.out.println(dict);
        });
    }
}
Also used : Dict(cn.hutool.core.lang.Dict) ExecutorService(java.util.concurrent.ExecutorService) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Aggregations

Dict (cn.hutool.core.lang.Dict)33 Test (org.junit.Test)25 File (java.io.File)4 FileWriter (java.io.FileWriter)3 Writer (java.io.Writer)3 ArrayList (java.util.ArrayList)3 BaseTest (cn.e3mall.common.freemarker.BaseTest)2 JexlEngine (cn.hutool.extra.expression.engine.jexl.JexlEngine)2 JfireELEngine (cn.hutool.extra.expression.engine.jfireel.JfireELEngine)2 MvelEngine (cn.hutool.extra.expression.engine.mvel.MvelEngine)2 RhinoEngine (cn.hutool.extra.expression.engine.rhino.RhinoEngine)2 SpELEngine (cn.hutool.extra.expression.engine.spel.SpELEngine)2 Configuration (freemarker.template.Configuration)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 StringWriter (java.io.StringWriter)2 Date (java.util.Date)2 List (java.util.List)2 Map (java.util.Map)2 Props (org.febit.wit.util.Props)2 Item (cn.e3mall.common.base.entity.Item)1