Atom extends Value { @Override public String toString() { return value.toString(); } Atom(T value); static Atom<String> string(String value); static Atom<Long> integer(long value); static Atom<Double> real(Double value); static Atom<Boolean> bool(boolean value); static Atom<Uuid> uuid(Uuid value); static Atom<Uuid> uuid(UUID value); static Atom<NamedUuid> namedUuid(NamedUuid value); static Atom<NamedUuid> namedUuid(String value); T getValue(); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString();  }
@Test public void testSerialization() throws JsonProcessingException { assertEquals("\"" + string + "\"", JsonUtil.serialize(atomString)); assertEquals(integer.toString(), JsonUtil.serialize(atomInteger)); assertEquals(real.toString(), JsonUtil.serialize(atomReal)); assertEquals(bool.toString(), JsonUtil.serialize(atomBoolean)); assertEquals("[\"uuid\",\"" + uuid.getUuid() + "\"]", JsonUtil.serialize(atomUuid)); assertEquals( "[\"named-uuid\",\"" + namedUuid.getUuidName() + "\"]", JsonUtil.serialize(atomNamedUuid) ); }
@Test public void testDeserialization() throws IOException { assertEquals(atomString, JsonUtil.deserialize('\"' + string + '\"', Atom.class)); assertEquals(atomInteger, JsonUtil.deserialize(integer.toString(), Atom.class)); assertEquals(atomReal, JsonUtil.deserialize(real.toString(), Atom.class)); assertEquals(atomBoolean, JsonUtil.deserialize(bool.toString(), Atom.class)); assertEquals( atomUuid, JsonUtil.deserialize("[\"uuid\",\"" + uuid.getUuid() + "\"]", Atom.class) ); assertEquals( atomNamedUuid, JsonUtil.deserialize("[\"named-uuid\",\"" + namedUuid.getUuidName() + "\"]", Atom.class) ); }