package geniusweb.domainsrepo; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Arrays; import java.util.Collection; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import com.fasterxml.jackson.databind.ObjectMapper; import geniusweb.profile.Profile; @RunWith(Parameterized.class) public class DomainsRepoTest { private static final ObjectMapper jackson = new ObjectMapper(); @Parameterized.Parameters public static Collection filenames() { return Arrays.asList(new String[][] { { "7issues/7issues1.json" }, { "7issues/7issues2.json" }, { "fitness/fitness1.json" }, { "fitness/fitness2.json" }, { "flightbooking/flightbooking1.json" }, { "flightbooking/flightbooking2.json" }, { "japantrip/japantrip1.json" }, { "japantrip/japantrip2.json" }, { "jobs/jobs1.json" }, { "jobs/jobs2.json" }, { "laptop/laptopBuyer.json" }, { "laptop/laptopSeller.json" }, { "party/party1.json" }, { "party/party2.json" }, { "party/party3.json" }, { "party/party4.json" } }); } private String filename; public DomainsRepoTest(String filename) throws IOException { this.filename = filename; } @Test public void testLoadFile() throws IOException { String profile = new String( Files.readAllBytes( Paths.get("src/main/webapp/domainsrepo/" + filename)), StandardCharsets.UTF_8); jackson.readValue(profile, Profile.class); } }