source: bidspace/src/test/java/geniusweb/bidspace/PartialSpaceFromUtilityTest.java@ 33

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

Major update. Changes in json serialization, maven dependencies and BOA. Fix in stand-alone runner.

File size: 997 bytes
RevLine 
[33]1package geniusweb.bidspace;
2
3import static org.junit.Assert.assertTrue;
4
5import java.io.IOException;
6import java.nio.file.Files;
7import java.nio.file.Paths;
8
9import org.junit.Test;
10
11import com.fasterxml.jackson.databind.ObjectMapper;
12
13import geniusweb.profile.Profile;
14import geniusweb.profile.utilityspace.LinearAdditiveUtilitySpace;
15
16public class PartialSpaceFromUtilityTest {
17 private final static ObjectMapper jackson = new ObjectMapper();
18
19 @Test
20 public void createPartialSpaceJobs() throws IOException {
21 String file1 = new String(Files
22 .readAllBytes(Paths.get("src/test/resources/jobs/jobs1.json")));
23 LinearAdditiveUtilitySpace profile = (LinearAdditiveUtilitySpace) jackson
24 .readValue(file1, Profile.class);
25 PartialSpaceFromUtility partial = new PartialSpaceFromUtility(profile,
26 20);
27 System.out.println(jackson.writeValueAsString(partial));
28 int size = partial.getBetter().size();
29 assertTrue(size >= 20); // sometimes 20, sometimes 21
30 assertTrue(size <= 21);
31 }
32}
Note: See TracBrowser for help on using the repository browser.