summaryrefslogtreecommitdiff
path: root/src/test/java/com/keuin/kbackupfabric/config/KBackupConfigTest.java
blob: 811156a2d688fbe789892e3f4793119ad667f58a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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());
    }
}