DynamicServiceAnnouncement { @NotNull public Map<String, String> getProperties() { return properties; } @JsonCreator  DynamicServiceAnnouncement(
            @JsonProperty("id") Id<Service> id,
            @JsonProperty("type") String type,
            @JsonProperty("properties") Map<String, String> properties); @NotNull Id<Service> getId(); @NotNull String getType(); @NotNull Map<String, String> getProperties(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static Function<DynamicServiceAnnouncement, Service> toServiceWith(final Id<Node> nodeId, final String location, final String pool);  }
@Test public void testCreatesDefensiveCopyOfProperties() { Map<String, String> properties = Maps.newHashMap(); properties.put("key", "value"); DynamicServiceAnnouncement announcement = new DynamicServiceAnnouncement(Id.<Service>random(), "type", properties); assertEquals(announcement.getProperties(), properties); properties.put("key2", "value2"); assertNotEquals(announcement.getProperties(), properties); }
@Test public void testImmutableProperties() { DynamicServiceAnnouncement announcement = new DynamicServiceAnnouncement (Id.<Service>random(), "type", ImmutableMap.of("key", "value")); try { announcement.getProperties().put("key2", "value2"); assertEquals(announcement.getProperties(), ImmutableMap.of("key", "value")); } catch (UnsupportedOperationException e) { } }