ForcedRoot implements JsonObjectConvertible, Comparable<ForcedRoot> { @Override public String toString() { return toJson().toString(); }  @NotNull static ForcedRoot.JsonKeys keys(); @Nullable String getPath(); void setPath(final @Nullable String path); @Nullable String getPrimaryType(); void setPrimaryType(final @Nullable String primaryType); @NotNull List<String> getMixinTypes(); void setMixinTypes(final @Nullable List<String> mixinTypes); @SuppressWarnings("WeakerAccess") ForcedRoot withPath(final @Nullable String path); @SuppressWarnings("WeakerAccess") ForcedRoot withPrimaryType(final @Nullable String primaryType); @SuppressWarnings("WeakerAccess") ForcedRoot withMixinTypes(final @NotNull String... mixinTypes); final boolean hasPath(); static @NotNull ForcedRoot fromJson(final @NotNull JsonObject json); @NotNull String[] getNamespacePrefixes(); @Override JsonObject toJson(); @Override int compareTo(final @NotNull ForcedRoot o); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void testToString() { final ForcedRoot.JsonKeys keys = ForcedRoot.keys(); final String path = "/correct/path"; final String primaryType = "primaryType"; final List<String> mixinTypes = Collections.singletonList("mixinType"); final ForcedRoot root = new ForcedRoot() .withPath(path) .withPrimaryType(primaryType) .withMixinTypes(mixinTypes.get(0)); final String jsonString = root.toString(); final String expectString = key(keys.path(), path) .key(keys.primaryType(), primaryType) .key(keys.mixinTypes(), mixinTypes) .get().toString(); assertEquals("expect json string for toString", expectString, jsonString); }