### Question:
Rdbms implements Serializable { public static Rdbms of(@NotNull final String code) { String theCode = code.intern(); Rdbms newRdbms = new Rdbms(theCode); Rdbms oldRdbms = RdbmsMarkersCache.cache.putIfAbsent(theCode, newRdbms); return notNull(oldRdbms, newRdbms); } private  Rdbms(@NotNull final String code); static Rdbms of(@NotNull final String code); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @NotNull
  final String code; }### Answer:
@SuppressWarnings("RedundantStringConstructorCall") @Test public void dedulplicate_on_create() { String str1 = new String("FantasticDB"); String str2 = new String("FantasticDB"); assertThat(str2).isNotSameAs(str1); Rdbms rdbms1 = Rdbms.of(str1); Rdbms rdbms2 = Rdbms.of(str2); assertThat(rdbms2).isSameAs(rdbms1); }
@Test public void serialization() throws IOException, ClassNotFoundException { JustAClass c1 = new JustAClass(Rdbms.of("MicroDB")); ByteArrayOutputStream os = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(os); oos.writeObject(c1); ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray()); ObjectInputStream ois = new ObjectInputStream(is); Object gotObject = ois.readObject(); assertThat(gotObject).isInstanceOf(JustAClass.class); JustAClass c2 = (JustAClass) gotObject; assertThat(c2.rdbms).isSameAs(c1.rdbms); }