### Question:
CategoryAndSampleKinds implements Comparable<CategoryAndSampleKinds> { public void addSampleKind(final String sampleKind) { sampleKinds.add(sampleKind); } CategoryAndSampleKinds(final String eventCategory); @JsonCreator  CategoryAndSampleKinds(@JsonProperty("eventCategory") final String eventCategory, @JsonProperty("sampleKinds") final List<String> sampleKinds); void addSampleKind(final String sampleKind); String getEventCategory(); Set<String> getSampleKinds(); @Override String toString(); @Override boolean equals(final Object o); @Override int hashCode(); @Override int compareTo(final CategoryAndSampleKinds o);  }### Answer:
@Test(groups = "fast") public void testMapping() throws Exception { final CategoryAndSampleKinds kinds = new CategoryAndSampleKinds("JVM"); kinds.addSampleKind("GC"); kinds.addSampleKind("CPU"); final ObjectMapper mapper = new ObjectMapper(); final String json = mapper.writeValueAsString(kinds); Assert.assertEquals("{\"eventCategory\":\"JVM\",\"sampleKinds\":[\"GC\",\"CPU\"]}", json); final CategoryAndSampleKinds kindsFromJson = mapper.readValue(json, CategoryAndSampleKinds.class); Assert.assertEquals(kindsFromJson, kinds); }