Changeset 10 for profile/src/test/java
- Timestamp:
- 01/28/20 10:19:54 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
profile/src/test/java/geniusweb/profile/utilityspace/NumberValueSetUtilTest.java
r9 r10 3 3 import static org.junit.Assert.assertEquals; 4 4 5 import java.io.IOException; 5 6 import java.math.BigDecimal; 6 7 import java.util.Arrays; … … 8 9 9 10 import org.junit.Test; 11 12 import com.fasterxml.jackson.core.JsonParseException; 13 import com.fasterxml.jackson.core.JsonProcessingException; 14 import com.fasterxml.jackson.databind.JsonMappingException; 15 import com.fasterxml.jackson.databind.ObjectMapper; 10 16 11 17 import geniusweb.issuevalue.DiscreteValue; … … 35 41 lowval1, low1util, highvalb, highutil); 36 42 private static final BigDecimal ZERO_1 = new BigDecimal("0.1"); 43 private final String utilstring = "{\"numberutils\":{\"lowValue\":12.5,\"lowUtility\":0.5,\"highValue\":18.5,\"highUtility\":0.9}}"; 44 45 private static final ObjectMapper jackson = new ObjectMapper(); 37 46 38 47 @Override … … 173 182 } 174 183 184 @Test 185 public void testSerialize() throws JsonProcessingException { 186 187 String json = jackson.writeValueAsString(valueset1); 188 System.out.println(json); 189 assertEquals(utilstring, json); 190 } 191 192 @Test 193 public void testDeserialize() 194 throws JsonParseException, JsonMappingException, IOException { 195 ValueSetUtilities valueutils = jackson.readValue(utilstring, 196 ValueSetUtilities.class); 197 assertEquals(valueset1, valueutils); 198 199 } 200 175 201 }
Note:
See TracChangeset
for help on using the changeset viewer.