JSONSerializer.toString(Double.POSITIVE_INFINITY);
}
@Test
public void testEquals() throws IOException, SerializationException {
JSONSerializer jsonSerializer = new JSONSerializer();
JSONSerializerListener jsonSerializerListener = new JSONSerializerListener() {
@Override
public void beginDictionary(JSONSerializer jsonSerializerArgument, Dictionary<String, ?> value) {
System.out.println("Begin dictionary: " + value);
}
@Override
public void endDictionary(JSONSerializer jsonSerializerArgument) {
System.out.println("End dictionary");
}
@Override
public void readKey(JSONSerializer jsonSerializerArgument, String key) {
System.out.println("Read key: " + key);
}
@Override
public void beginSequence(JSONSerializer jsonSerializerArgument, Sequence<?> value) {
System.out.println("Begin sequence: " + value);
}
@Override
public void endSequence(JSONSerializer jsonSerializerArgument) {
System.out.println("End sequence");
}
@Override
public void readString(JSONSerializer jsonSerializerArgument, String value) {
System.out.println("Read string: " + value);
}
@Override
public void readNumber(JSONSerializer jsonSerializerArgument, Number value) {
System.out.println("Read number: " + value);
}
@Override
public void readBoolean(JSONSerializer jsonSerializerArgument, Boolean value) {
System.out.println("Read boolean: " + value);
}
@Override
public void readNull(JSONSerializer jsonSerializerArgument) {
System.out.println("Read null");
}
};
jsonSerializer.getJSONSerializerListeners().add(jsonSerializerListener);
Object o1 = jsonSerializer.readObject(getClass().getResourceAsStream("map.json"));
assertEquals(JSON.get(o1, "e.g"), 5);
jsonSerializer.getJSONSerializerListeners().remove(jsonSerializerListener);
Object o2 = jsonSerializer.readObject(getClass().getResourceAsStream("map.json"));
assertTrue(o1.equals(o2));
List<?> d = JSON.get(o1, "d");
d.remove(0, 1);