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