Changeset 9 for profile/src/test/java
- Timestamp:
- 11/28/19 14:40:48 (5 years ago)
- Location:
- profile/src/test/java/geniusweb/profile/utilityspace
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
profile/src/test/java/geniusweb/profile/utilityspace/DiscreteValueSetUtilitiesTest.java
r7 r9 3 3 import static org.junit.Assert.assertEquals; 4 4 import static org.junit.Assert.assertFalse; 5 import static org.junit.Assert.assertTrue; 5 6 6 7 import java.io.IOException; … … 81 82 @Override 82 83 public List<String> getGeneralTestStrings() { 83 return Arrays.asList(" ValueSetUtilities\\{\"a\"=0.14\\}",84 " ValueSetUtilities\\{\"b\"=0.37\\}",85 " ValueSetUtilities\\{\"a\"=0.37\\}",86 " ValueSetUtilities\\{\"a\"=0.14, \"b\"=0.37\\}");84 return Arrays.asList("DiscreteValueSetUtilities\\{\"a\"=0.14\\}", 85 "DiscreteValueSetUtilities\\{\"b\"=0.37\\}", 86 "DiscreteValueSetUtilities\\{\"a\"=0.37\\}", 87 "DiscreteValueSetUtilities\\{\"a\"=0.14, \"b\"=0.37\\}"); 87 88 } 88 89 … … 200 201 201 202 } 203 204 @Test 205 public void testDeserializeAsDiscrete() 206 throws JsonParseException, JsonMappingException, IOException { 207 // Check that DiscreteValueSetUtilities properly deserializes 208 // discreteutils. 209 String utilstring = "{\"discreteutils\": {\"valueUtilities\": {\"Party Tent\": 0.52,\"Your Dorm\": 0.23,\"Party Room\": 0.99,\"Ballroom\": 0.77}}}"; 210 DiscreteValueSetUtilities valueutils = jackson.readValue(utilstring, 211 DiscreteValueSetUtilities.class); 212 assertTrue(new BigDecimal("0.23").compareTo( 213 valueutils.getUtility(new DiscreteValue("Your Dorm"))) == 0); 214 215 } 216 202 217 } -
profile/src/test/java/geniusweb/profile/utilityspace/LinearAdditiveTest.java
r7 r9 20 20 21 21 import com.fasterxml.jackson.databind.ObjectMapper; 22 import com.fasterxml.jackson.databind.exc.InvalidDefinitionException;23 22 24 23 import geniusweb.issuevalue.Bid; … … 145 144 public List<String> getGeneralTestStrings() { 146 145 return Arrays.asList( 147 "LinearAdditive\\[\\{issue2= ValueSetUtilities\\{\"issue2value2\"=0.8, \"issue2value1\"=0.6\\}, issue1=ValueSetUtilities\\{\"issue1value1\"=0.3, \"issue1value2\"=0.2\\}\\},\\{issue2=0.6, issue1=0.4\\},Bid\\{issue2=\"issue2value1\", issue1=\"issue1value2\"\\}\\]",148 "LinearAdditive\\[\\{issue2= ValueSetUtilities\\{\"issue2value2\"=0.8, \"issue2value1\"=0.6\\}, issue1=ValueSetUtilities\\{\"issue1value1\"=0.3, \"issue1value2\"=0.2\\}\\},\\{issue2=0.7, issue1=0.3\\},Bid\\{issue2=\"issue2value1\", issue1=\"issue1value2\"\\}\\]",149 "LinearAdditive\\[\\{issue2= ValueSetUtilities\\{\"issue2value2\"=0.2, \"issue2value1\"=0.3\\}, issue1=ValueSetUtilities\\{\"issue1value1\"=0.6, \"issue1value2\"=0.8\\}\\},\\{issue2=0.6, issue1=0.4\\},Bid\\{issue2=\"issue2value1\", issue1=\"issue1value2\"\\}\\]",150 "LinearAdditive\\[\\{issue2= ValueSetUtilities\\{\"issue2value2\"=0.2, \"issue2value1\"=0.3\\}, issue1=ValueSetUtilities\\{\"issue1value1\"=0.6, \"issue1value2\"=0.8\\}\\},\\{issue2=0.6, issue1=0.4\\},Bid\\{issue2=\"issue2value1\", issue1=\"issue1value1\"\\}\\]");146 "LinearAdditive\\[\\{issue2=DiscreteValueSetUtilities\\{\"issue2value2\"=0.8, \"issue2value1\"=0.6\\}, issue1=DiscreteValueSetUtilities\\{\"issue1value1\"=0.3, \"issue1value2\"=0.2\\}\\},\\{issue2=0.6, issue1=0.4\\},Bid\\{issue2=\"issue2value1\", issue1=\"issue1value2\"\\}\\]", 147 "LinearAdditive\\[\\{issue2=DiscreteValueSetUtilities\\{\"issue2value2\"=0.8, \"issue2value1\"=0.6\\}, issue1=DiscreteValueSetUtilities\\{\"issue1value1\"=0.3, \"issue1value2\"=0.2\\}\\},\\{issue2=0.7, issue1=0.3\\},Bid\\{issue2=\"issue2value1\", issue1=\"issue1value2\"\\}\\]", 148 "LinearAdditive\\[\\{issue2=DiscreteValueSetUtilities\\{\"issue2value2\"=0.2, \"issue2value1\"=0.3\\}, issue1=DiscreteValueSetUtilities\\{\"issue1value1\"=0.6, \"issue1value2\"=0.8\\}\\},\\{issue2=0.6, issue1=0.4\\},Bid\\{issue2=\"issue2value1\", issue1=\"issue1value2\"\\}\\]", 149 "LinearAdditive\\[\\{issue2=DiscreteValueSetUtilities\\{\"issue2value2\"=0.2, \"issue2value1\"=0.3\\}, issue1=DiscreteValueSetUtilities\\{\"issue1value1\"=0.6, \"issue1value2\"=0.8\\}\\},\\{issue2=0.6, issue1=0.4\\},Bid\\{issue2=\"issue2value1\", issue1=\"issue1value1\"\\}\\]"); 151 150 } 152 151 … … 271 270 } 272 271 273 @Test (expected = InvalidDefinitionException.class)272 @Test 274 273 public void loadFullWithJson() throws IOException { 275 274 String profile = new String( -
profile/src/test/java/geniusweb/profile/utilityspace/NumberValueSetUtilTest.java
r3 r9 44 44 @Override 45 45 public List<String> getGeneralTestStrings() { 46 return Arrays.asList("NumberVal Utility\\(12.5->0.5,18.5->0.9\\)",47 "NumberVal Utility\\(12.5->0.6,18.5->0.9\\)",48 "NumberVal Utility\\(12.5->0.5,18.4->0.9\\)");46 return Arrays.asList("NumberValueSetUtilities\\(12.5->0.5,18.5->0.9\\)", 47 "NumberValueSetUtilities\\(12.5->0.6,18.5->0.9\\)", 48 "NumberValueSetUtilities\\(12.5->0.5,18.4->0.9\\)"); 49 49 } 50 50
Note:
See TracChangeset
for help on using the changeset viewer.