ServiceAnnouncement { private ServiceAnnouncement(String type, Map<String, String> properties) { this.type = requireNonNull(type, "type is null"); this.properties = ImmutableMap.copyOf(requireNonNull(properties, "properties is null")); error = null; } private  ServiceAnnouncement(String type, Map<String, String> properties); private  ServiceAnnouncement(String error); @JsonProperty UUID getId(); @JsonProperty String getType(); @Nullable String getError(); @JsonProperty Map<String, String> getProperties(); @Override String toString(); ServiceDescriptor toServiceDescriptor(NodeInfo nodeInfo); static ServiceAnnouncementBuilder serviceAnnouncement(String type); static ServiceAnnouncement serviceAnnouncementError(String error);  }
@Test public void testBuilder() { assertAnnouncement(serviceAnnouncement("foo").build(), "foo", ImmutableMap.of()); assertAnnouncement(serviceAnnouncement("foo").build(), "foo", ImmutableMap.of()); assertAnnouncement(serviceAnnouncement("foo").addProperty("a", "apple").build(), "foo", ImmutableMap.of("a", "apple")); assertAnnouncement(serviceAnnouncement("foo").addProperties(ImmutableMap.of("a", "apple", "b", "banana")).build(), "foo", ImmutableMap.of("a", "apple", "b", "banana")); }