[43] | 1 | package geniusweb.domainsrepo;
|
---|
| 2 |
|
---|
| 3 | import java.io.IOException;
|
---|
| 4 | import java.nio.charset.StandardCharsets;
|
---|
| 5 | import java.nio.file.Files;
|
---|
| 6 | import java.nio.file.Paths;
|
---|
| 7 | import java.util.Arrays;
|
---|
| 8 | import java.util.Collection;
|
---|
| 9 |
|
---|
| 10 | import org.junit.Test;
|
---|
| 11 | import org.junit.runner.RunWith;
|
---|
| 12 | import org.junit.runners.Parameterized;
|
---|
| 13 |
|
---|
| 14 | import com.fasterxml.jackson.databind.ObjectMapper;
|
---|
| 15 |
|
---|
| 16 | import geniusweb.profile.Profile;
|
---|
| 17 |
|
---|
| 18 | @RunWith(Parameterized.class)
|
---|
| 19 | public 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 | }
|
---|