### Question:
InstanceId implements Serializable, Comparable<InstanceId> { @JsonCreator public static InstanceId of(String value) { return new InstanceId(value); } private  InstanceId(String value); @JsonCreator static InstanceId of(String value); @JsonValue @Override String toString(); @Override int compareTo(InstanceId that);  }### Answer:
@Test public void invariants() { assertThatThrownBy(() -> InstanceId.of(null)).isInstanceOf(IllegalArgumentException.class) .hasMessage("'value' must have text"); assertThatThrownBy(() -> InstanceId.of("")).isInstanceOf(IllegalArgumentException.class) .hasMessage("'value' must have text"); }
@Test public void json() throws JsonProcessingException { assertThat(new ObjectMapper().writeValueAsString(InstanceId.of("abc"))).isEqualTo("\"abc\""); }