DynamicAnnouncement { @Override public String toString() { return "DynamicAnnouncement{" + "environment='" + environment + '\'' + ", location='" + location + '\'' + ", pool='" + pool + '\'' + ", services=" + services + '}'; } @JsonCreator  DynamicAnnouncement(
            @JsonProperty("environment") String environment,
            @JsonProperty("pool") String pool,
            @JsonProperty("location") String location,
            @JsonProperty("services") Set<DynamicServiceAnnouncement> services); @NotNull String getEnvironment(); String getLocation(); @NotNull String getPool(); @NotNull @Valid Set<DynamicServiceAnnouncement> getServiceAnnouncements(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static Builder copyOf(DynamicAnnouncement announcement);  }
@Test public void testParsing() throws IOException { JsonCodec<DynamicAnnouncement> codec = JsonCodec.jsonCodec(DynamicAnnouncement.class); DynamicAnnouncement parsed = codec.fromJson(Resources.toString(Resources.getResource("announcement.json"), Charsets.UTF_8)); DynamicServiceAnnouncement red = new DynamicServiceAnnouncement(Id.<Service>valueOf("1c001650-7841-11e0-a1f0-0800200c9a66"), "red", ImmutableMap.of("key", "redValue")); DynamicServiceAnnouncement blue = new DynamicServiceAnnouncement(Id.<Service>valueOf("2a817750-7841-11e0-a1f0-0800200c9a66"), "blue", ImmutableMap.of("key", "blueValue")); DynamicAnnouncement expected = new DynamicAnnouncement("testing", "poolA", "/a/b/c", ImmutableSet.of(red, blue)); assertEquals(parsed, expected); }
@Test public void testToString() { DynamicAnnouncement announcement = new DynamicAnnouncement("testing", "pool", "/location", ImmutableSet.of( new DynamicServiceAnnouncement(Id.<Service>random(), "type", Collections.<String, String>emptyMap())) ); assertNotNull(announcement.toString()); }