SubModel { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SubModel that = (SubModel) o; return Objects.equals(languageModel, that.languageModel) && Objects.equals(dialog, that.dialog) && Objects.equals(prompts, that.prompts); } SubModel(SubLanguageModel languageModel, Dialog dialog, List<Prompt> prompts); @JsonProperty("languageModel") SubLanguageModel getLanguageModel(); @JsonProperty("dialog") Dialog getDialog(); @JsonProperty("prompts") List<Prompt> getPrompts(); @Override boolean equals(Object o); @Override int hashCode(); static Builder builder();  }
@Test public void testEquals() { SubModel left = SubModel.builder() .withLanguageModel(SubLanguageModel.builder() .withIntents(Collections.singletonList( Intent.builder() .withName("test") .withSamples(Collections.singletonList("test")) .withSlots(Collections.singletonList( Slot.builder() .withName("test") .withType("test") .build() )) .build() )) .build()) .withDialog(Dialog.builder() .withIntents(Collections.singletonList( DialogIntent.builder() .withName("test") .withConfirmationRequired(true) .withPrompts(DialogIntentPrompt.builder() .withConfirmation("test") .build()) .withSlots(Collections.singletonList( DialogSlot.builder() .withName("test") .withType("test") .withConfirmationRequired(true) .withElicitationRequired(true) .withPrompts(DialogSlotPrompt.builder() .withConfirmation("testConfirm") .withElicitation("testElicit") .build()) .build() )) .build() )) .build()) .addPrompts(Collections.singletonList( Prompt.builder() .withId("test") .withVariations(Collections.singletonList( PromptVariation.builder() .withType("PlainText") .withValue("test") .build() )) .build() )) .build(); SubModel right = SubModel.builder() .withLanguageModel(SubLanguageModel.builder() .withIntents(Collections.singletonList( Intent.builder() .withName("test") .withSamples(Collections.singletonList("test")) .withSlots(Collections.singletonList( Slot.builder() .withName("test") .withType("test") .build() )) .build() )) .build()) .withDialog(Dialog.builder() .withIntents(Collections.singletonList( DialogIntent.builder() .withName("test") .withConfirmationRequired(true) .withPrompts(DialogIntentPrompt.builder() .withConfirmation("test") .build()) .withSlots(Collections.singletonList( DialogSlot.builder() .withName("test") .withType("test") .withConfirmationRequired(true) .withElicitationRequired(true) .withPrompts(DialogSlotPrompt.builder() .withConfirmation("testConfirm") .withElicitation("testElicit") .build()) .build() )) .build() )) .build()) .addPrompts(Collections.singletonList( Prompt.builder() .withId("test") .withVariations(Collections.singletonList( PromptVariation.builder() .withType("PlainText") .withValue("test") .build() )) .build() )) .build(); assertEquals(left, right); assertEquals(left.hashCode(), right.hashCode()); }