### Question:
SocialActivityContainerResource extends ContainerResource { public Collection<SocialActivityModel> getActivities() { return activities; } @JsonCreator  SocialActivityContainerResource(
      @JsonProperty("id") String id,
      @JsonProperty("actor") SocialActivityActor actor,
      @JsonProperty("activities") Collection<SocialActivityModel> activities); Collection<SocialActivityModel> getActivities(); SocialActivityActor getActor(); String getId(); @Override boolean equals(Object o); @Override int hashCode();  }### Answer:
@Test public void verifySerializeDeserialize() throws Exception { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.registerModule(new JavaTimeModule()); objectMapper.registerSubtypes(SocialActivityContainerResource.class); Instant timePublished = OffsetDateTime.of(1970, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC).toInstant(); SocialActivityLocation location = new SocialActivityLocation("Somewhere", 0, 0); SocialActivityAttachment linkAttachment = new SocialActivityAttachment( SocialActivityAttachmentType.LINK, "some url", "some link", "this is the link text"); SocialActivityAttachment imageAttachment = new SocialActivityAttachment( SocialActivityAttachmentType.IMAGE, "some image url", "some image", "this is the image description"); List<SocialActivityModel> activities = ImmutableList.of( new SocialActivityModel( "id1", timePublished, SocialActivityType.NOTE, null, null, "Write Better tests", "Here's some sample content", "https: new SocialActivityModel( "id2", timePublished, SocialActivityType.POST, ImmutableList.of(linkAttachment, imageAttachment), null, "Write Some more tests", "Here's some sample post content", "https: new SocialActivityModel( "id3", timePublished, SocialActivityType.CHECKIN, null, location, "Write Some location tests", "Here's some sample checkin content", "https: SocialActivityActor actor = new SocialActivityActor("actor ID", "actor url", "facebook.com/zuck"); ContainerResource data = new SocialActivityContainerResource("someID", actor, activities); String serialized = objectMapper.writeValueAsString(data); ContainerResource deserializedModel = objectMapper.readValue(serialized, ContainerResource.class); Truth.assertThat(deserializedModel).isNotNull(); Truth.assertThat(deserializedModel).isInstanceOf(SocialActivityContainerResource.class); SocialActivityContainerResource deserialized = (SocialActivityContainerResource) deserializedModel; Truth.assertThat(deserialized.getActivities()).hasSize(3); Truth.assertThat(deserialized).isEqualTo(data); }