Storage Repository : système simplifié
This commit is contained in:
@@ -1,13 +1,10 @@
|
||||
package lightcontainer.storage;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.InvalidPathException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@@ -49,7 +46,8 @@ public class RepositoryTests {
|
||||
JsonAdapter jsonAdapter = new JsonAdapter(appData);
|
||||
//WHEN Repository calls save method
|
||||
String filePath = "src/test/resources/test.json";
|
||||
Repository.save(filePath, jsonAdapter);
|
||||
Repository repository = new Repository(filePath, jsonAdapter);
|
||||
repository.save();
|
||||
//THEN
|
||||
assertTrue(Files.exists(Paths.get("src/test/resources/test.json").toAbsolutePath()));
|
||||
}
|
||||
@@ -59,7 +57,8 @@ public class RepositoryTests {
|
||||
//GIVEN a test json file loadTest.json
|
||||
JsonAdapter jsonAdapter = new JsonAdapter(null);
|
||||
//WHEN repository calls load method
|
||||
AppData appData = Repository.load("src/test/resources/loadTest.json", jsonAdapter);
|
||||
Repository repository = new Repository("src/test/resources/loadTest.json", jsonAdapter);
|
||||
AppData appData = repository.load();
|
||||
//THEN
|
||||
assertNotNull(appData.getAppConfig());
|
||||
assertEquals("My network interface", appData.getAppConfig().getNetworkInterface());
|
||||
|
||||
Reference in New Issue
Block a user