/** * Merge this instance with the specified argument. * @param other the other instance */ public void merge(InitializrMetadata other) { this.configuration.merge(other.configuration); this.dependencies.merge(other.dependencies); this.types.merge(other.types); this.bootVersions.merge(other.bootVersions); this.packagings.merge(other.packagings); this.javaVersions.merge(other.javaVersions); this.languages.merge(other.languages); this.name.merge(other.name); this.description.merge(other.description); this.groupId.merge(other.groupId); this.artifactId.merge(other.artifactId); this.version.merge(other.version); this.packageName.merge(other.packageName); }
@Test void mergeTitle() { TextCapability capability = new TextCapability("foo", "Foo", "my desc"); capability.merge(new TextCapability("foo", "AnotherFoo", "")); assertThat(capability.getId()).isEqualTo("foo"); assertThat(capability.getType()).isEqualTo(ServiceCapabilityType.TEXT); assertThat(capability.getTitle()).isEqualTo("AnotherFoo"); assertThat(capability.getDescription()).isEqualTo("my desc"); }
@Test void mergeDescription() { TextCapability capability = new TextCapability("foo", "Foo", "my desc"); capability.merge(new TextCapability("foo", "", "another desc")); assertThat(capability.getId()).isEqualTo("foo"); assertThat(capability.getType()).isEqualTo(ServiceCapabilityType.TEXT); assertThat(capability.getTitle()).isEqualTo("Foo"); assertThat(capability.getDescription()).isEqualTo("another desc"); }
@Test void mergeValue() { TextCapability capability = new TextCapability("foo"); capability.setContent("1234"); TextCapability another = new TextCapability("foo"); another.setContent("4567"); capability.merge(another); assertThat(capability.getId()).isEqualTo("foo"); assertThat(capability.getType()).isEqualTo(ServiceCapabilityType.TEXT); assertThat(capability.getContent()).isEqualTo("4567"); }