use of uk.gov.gchq.gaffer.serialisation.DoubleSerialiser in project Gaffer by gchq.
the class CustomMapTest method shouldJSONSerialiseBigIntString.
@Test
public void shouldJSONSerialiseBigIntString() throws IOException {
// given
final CustomMap<TreeSet<String>, Double> expectedMap = new CustomMap<>(new TreeSetStringSerialiser(), new DoubleSerialiser());
final TreeSet<String> key1 = new TreeSet<>();
key1.add("k1");
key1.add("k2");
expectedMap.put(key1, 11.11);
final TreeSet<String> key2 = new TreeSet<>();
key2.add("k3");
key2.add("k4");
expectedMap.put(key2, 22.22);
final String expectedJson = jsonFromFile("custom-map02.json");
// when
final byte[] serialise = JSONSerialiser.serialise(expectedMap, true);
final CustomMap jsonMap = JSONSerialiser.deserialise(expectedJson, CustomMap.class);
final CustomMap deserialiseMap = JSONSerialiser.deserialise(serialise, CustomMap.class);
// then
assertEquals(jsonMap, deserialiseMap, "The expected map from Json doesn't match");
assertEquals(expectedMap, deserialiseMap, "The expected map doesn't match");
}
Aggregations