mirror of
https://github.com/Geniusay/ChopperBot.git
synced 2026-05-24 05:11:11 +08:00
配置文件架构的小完善
This commit is contained in:
@@ -22,6 +22,26 @@ import java.util.Map;
|
||||
|
||||
public class JsonFileUtilTest {
|
||||
|
||||
@Test
|
||||
public void writeMapObj() throws IOException {
|
||||
Student student = new Student(
|
||||
"Genius",
|
||||
18,
|
||||
"HUST",
|
||||
"CS",
|
||||
List.of("Coding", "Reading", "Playing"),
|
||||
Map.of("QQ", "123456789", "WeChat", "987654321")
|
||||
);
|
||||
JsonFileUtil.writeJsonFile("E:\\Project\\ChopperBot\\FileModule\\src\\main\\resources\\student2.json",
|
||||
Map.of("Student", student,"hello","11234"));
|
||||
Map<String, Object> stringObjectMap = JsonFileUtil.readJsonFile("E:\\Project\\ChopperBot\\FileModule\\src\\main\\resources\\student2.json");
|
||||
stringObjectMap.forEach(
|
||||
(k,v)->{
|
||||
System.out.println(k);
|
||||
System.out.println(v.getClass());
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@@ -64,4 +84,5 @@ public class JsonFileUtilTest {
|
||||
JsonFileUtil.writeBigJsonFile(dir.toString(),maps);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user