source: src/test/java/geniusweb/domainsrepo/DomainsRepoTest.java@ 38

Last change on this file since 38 was 38, checked in by bart, 3 years ago

refactor to help reusing partiesserver

File size: 1.5 KB
RevLine 
[38]1package geniusweb.domainsrepo;
2
3import java.io.IOException;
4import java.nio.charset.StandardCharsets;
5import java.nio.file.Files;
6import java.nio.file.Paths;
7import java.util.Arrays;
8import java.util.Collection;
9
10import org.junit.Test;
11import org.junit.runner.RunWith;
12import org.junit.runners.Parameterized;
13
14import com.fasterxml.jackson.databind.ObjectMapper;
15
16import geniusweb.profile.Profile;
17
18@RunWith(Parameterized.class)
19public class DomainsRepoTest {
20 private static final ObjectMapper jackson = new ObjectMapper();
21
22 @Parameterized.Parameters
23 public static Collection filenames() {
24 return Arrays.asList(new String[][] { { "7issues/7issues1.json" },
25 { "7issues/7issues2.json" }, { "fitness/fitness1.json" },
26 { "fitness/fitness2.json" },
27 { "flightbooking/flightbooking1.json" },
28 { "flightbooking/flightbooking2.json" },
29 { "japantrip/japantrip1.json" },
30 { "japantrip/japantrip2.json" }, { "jobs/jobs1.json" },
31 { "jobs/jobs2.json" }, { "laptop/laptopBuyer.json" },
32 { "laptop/laptopSeller.json" }, { "party/party1.json" },
33 { "party/party2.json" }, { "party/party3.json" },
34 { "party/party4.json" }
35
36 });
37 }
38
39 private String filename;
40
41 public DomainsRepoTest(String filename) throws IOException {
42 this.filename = filename;
43 }
44
45 @Test
46 public void testLoadFile() throws IOException {
47 String profile = new String(
48 Files.readAllBytes(
49 Paths.get("src/main/webapp/domainsrepo/" + filename)),
50 StandardCharsets.UTF_8);
51 jackson.readValue(profile, Profile.class);
52 }
53}
Note: See TracBrowser for help on using the repository browser.