### Question:
Inet4Datum extends Datum { @Override public Datum equalsTo(Datum datum) { switch (datum.type()) { case INET4: return DatumFactory.createBool(this.address == ((Inet4Datum) datum).address); case NULL_TYPE: return datum; default: throw new InvalidOperationException(datum.type()); } } Inet4Datum(String addr);  Inet4Datum(byte[] addr);  Inet4Datum(byte[] addr, int offset, int length); @Override int asInt4(); @Override long asInt8(); @Override byte[] asByteArray(); @Override String asChars(); @Override int size(); @Override int hashCode(); @Override boolean equals(Object obj); @Override Datum equalsTo(Datum datum); @Override int compareTo(Datum datum);  }### Answer:
@Test public final void testJson() { Datum d = DatumFactory.createInet4("163.152.163.152"); String json = d.toJson(); Datum fromJson = CommonGsonHelper.fromJson(json, Datum.class); assertTrue(d.equalsTo(fromJson).asBool()); }