### Question:
ClusterEntity extends BaseEntity { public void setTags(@Nullable final Set<TagEntity> tags) { this.tags.clear(); if (tags != null) { this.tags.addAll(tags); } } ClusterEntity(); void setConfigs(@Nullable final Set<FileEntity> configs); void setDependencies(@Nullable final Set<FileEntity> dependencies); void setTags(@Nullable final Set<TagEntity> tags); @Override boolean equals(final Object o); @Override int hashCode(); static final String DTO_ENTITY_GRAPH; }### Answer:
@Test void testSetTags() { Assertions.assertThat(this.c.getTags()).isEmpty(); final TagEntity prodTag = new TagEntity(); prodTag.setTag("prod"); final TagEntity slaTag = new TagEntity(); slaTag.setTag("sla"); final Set<TagEntity> tags = Sets.newHashSet(prodTag, slaTag); this.c.setTags(tags); Assertions.assertThat(this.c.getTags()).isEqualTo(tags); this.c.setTags(null); Assertions.assertThat(this.c.getTags()).isEmpty(); }
@Test void canSetClusterTags() { final TagEntity oneTag = new TagEntity(); oneTag.setTag("one"); final TagEntity twoTag = new TagEntity(); twoTag.setTag("tow"); final TagEntity preTag = new TagEntity(); preTag.setTag("Pre"); final Set<TagEntity> tags = Sets.newHashSet(oneTag, twoTag, preTag); this.c.setTags(tags); Assertions.assertThat(this.c.getTags()).isEqualTo(tags); this.c.setTags(Sets.newHashSet()); Assertions.assertThat(this.c.getTags()).isEmpty(); this.c.setTags(null); Assertions.assertThat(this.c.getTags()).isEmpty(); }