diff options
author | Keuin <[email protected]> | 2024-01-20 18:54:10 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2024-01-20 19:05:25 +0800 |
commit | 44227db56e3669b6b1575bf750df815e6903c906 (patch) | |
tree | 57c7a5503659aa0676119d7a9bdb48164fa6724f /src/test/java | |
parent | 7e3cd92742383c43f2741449c551208e6487154e (diff) |
feature: config file support JSON comment
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/com/keuin/kbackupfabric/config/KBackupConfigTest.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/java/com/keuin/kbackupfabric/config/KBackupConfigTest.java b/src/test/java/com/keuin/kbackupfabric/config/KBackupConfigTest.java new file mode 100644 index 0000000..811156a --- /dev/null +++ b/src/test/java/com/keuin/kbackupfabric/config/KBackupConfigTest.java @@ -0,0 +1,29 @@ +package com.keuin.kbackupfabric.config; + +import com.keuin.kbackupfabric.TestUtils; +import org.junit.Test; + +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardOpenOption; + +public class KBackupConfigTest { + + @Test + public void load() throws Exception { + String tempDir = TestUtils.getTempDirectory("config_test"); + Files.createDirectories(Paths.get(tempDir)); + Path configPath = Paths.get(tempDir, "test_config.json"); + Files.write( + configPath, + "{\n//comment\n}".getBytes(StandardCharsets.UTF_8), + StandardOpenOption.CREATE, + StandardOpenOption.WRITE, + StandardOpenOption.TRUNCATE_EXISTING + ); + System.out.println(configPath.toFile().getAbsolutePath()); + KBackupConfig.load(configPath.toFile()); + } +}
\ No newline at end of file |