Repository : load testé
This commit is contained in:
@@ -30,7 +30,7 @@ public class RepositoryTests {
|
||||
|
||||
@Test
|
||||
public void save() {
|
||||
//GIVEN an AppData instance, a JsonAdapter and a Repository
|
||||
//GIVEN an AppData instance and a Json Adapter
|
||||
AppData appData = AppData.getInstance();
|
||||
AppConfig appConfig = AppConfig.getInstance();
|
||||
appConfig.setUnicastPort(32000);
|
||||
@@ -53,4 +53,19 @@ public class RepositoryTests {
|
||||
//THEN
|
||||
assertTrue(Files.exists(Paths.get("src/test/resources/test.json").toAbsolutePath()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void load() {
|
||||
//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);
|
||||
//THEN
|
||||
assertNotNull(appData.getAppConfig());
|
||||
assertEquals("My network interface", appData.getAppConfig().getNetworkInterface());
|
||||
assertEquals(32000, appData.getAppConfig().getUnicastPort());
|
||||
assertEquals("224.25.0.1", appData.getAppConfig().getMulticastIp());
|
||||
assertEquals(15502, appData.getAppConfig().getMulticastPort());
|
||||
assertFalse(appData.getAppConfig().isTls());
|
||||
}
|
||||
}
|
||||
|
||||
24
app/src/test/resources/loadTest.json
Normal file
24
app/src/test/resources/loadTest.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"unicast_port": 32000,
|
||||
"multicast_ip": "224.25.0.1",
|
||||
"multicast_port": 15502,
|
||||
"network_interface": "My network interface",
|
||||
"tls": false,
|
||||
"users": [
|
||||
{
|
||||
"name": "User1",
|
||||
"password": "Password",
|
||||
"aes_key": "djdjjdj",
|
||||
"files": [
|
||||
{
|
||||
"name": "File1",
|
||||
"size": 15,
|
||||
"iv": "8d8d8d8d",
|
||||
"storage": [
|
||||
"StorBackEnd1"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user