### Question:
Instances implements Record { @Override public String toString() { try { return JacksonUtils.toJson(this); } catch (Exception e) { throw new RuntimeException("Instances toJSON failed", e); } }  List<Instance> getInstanceList(); void setInstanceList(List<Instance> instanceList); @Override String toString(); @Override @JsonIgnore String getChecksum(); String convertMap2String(Map<String, String> map);  }### Answer:
@Test public void testToString() { Instances actual = new Instances(); Collection<Instance> instancesCase = createInstancesCase(); actual.getInstanceList().addAll(instancesCase); String expected = "{\"instanceList\":[" + StringUtils .join(instancesCase.stream().map(Instance::toJson).collect(Collectors.toList()), ",") + "]}"; assertEquals(expected, actual.toString()); }