package geniusweb.bidspace; import static org.junit.Assert.assertTrue; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import org.junit.Test; import com.fasterxml.jackson.databind.ObjectMapper; import geniusweb.profile.Profile; import geniusweb.profile.utilityspace.LinearAdditiveUtilitySpace; public class PartialSpaceFromUtilityTest { private final static ObjectMapper jackson = new ObjectMapper(); @Test public void createPartialSpaceJobs() throws IOException { String file1 = new String(Files .readAllBytes(Paths.get("src/test/resources/jobs/jobs1.json"))); LinearAdditiveUtilitySpace profile = (LinearAdditiveUtilitySpace) jackson .readValue(file1, Profile.class); PartialSpaceFromUtility partial = new PartialSpaceFromUtility(profile, 20); System.out.println(jackson.writeValueAsString(partial)); int size = partial.getBetter().size(); assertTrue(size >= 20); // sometimes 20, sometimes 21 assertTrue(size <= 21); } }