@Test public void testEquals() { InstanceData instanceData = new InstanceData(); InstanceData initialInstance = clone(instanceData); EqualsTester equalsTester = new EqualsTester(); equalsTester.addEqualityGroup(initialInstance, initialInstance).addEqualityGroup(new Object()); instanceData.setInstanceName("instanceName"); equalsTester.addEqualityGroup(clone(instanceData)); instanceData.setDescription("The description"); equalsTester.addEqualityGroup(clone(instanceData)); instanceData.setLongDescription("The long description"); equalsTester.addEqualityGroup(clone(instanceData)); instanceData.setOrderedVariableNames(ImmutableList.of("b", "a")); equalsTester.addEqualityGroup(clone(instanceData)); instanceData.setTags(new TreeSet<>(Arrays.asList("tag1", "tag2"))); equalsTester.addEqualityGroup(clone(instanceData)); Variable variable = new Variable(); variable.setType(Type.INTEGER); instanceData.setVariables(ImmutableSortedMap.of("v", variable)); equalsTester.addEqualityGroup(clone(instanceData)); equalsTester.testEquals(); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } InstanceData that = (InstanceData) o; return Objects.equals(_description, that._description) && Objects.equals(_instanceName, that._instanceName) && Objects.equals(_longDescription, that._longDescription) && Objects.equals(_orderedVariableNames, that._orderedVariableNames) && Objects.equals(_tags, that._tags) && Objects.equals(_variables, that._variables); }
InstanceData { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } InstanceData that = (InstanceData) o; return Objects.equals(_description, that._description) && Objects.equals(_instanceName, that._instanceName) && Objects.equals(_longDescription, that._longDescription) && Objects.equals(_orderedVariableNames, that._orderedVariableNames) && Objects.equals(_tags, that._tags) && Objects.equals(_variables, that._variables); } }
InstanceData { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } InstanceData that = (InstanceData) o; return Objects.equals(_description, that._description) && Objects.equals(_instanceName, that._instanceName) && Objects.equals(_longDescription, that._longDescription) && Objects.equals(_orderedVariableNames, that._orderedVariableNames) && Objects.equals(_tags, that._tags) && Objects.equals(_variables, that._variables); } InstanceData(); }
InstanceData { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } InstanceData that = (InstanceData) o; return Objects.equals(_description, that._description) && Objects.equals(_instanceName, that._instanceName) && Objects.equals(_longDescription, that._longDescription) && Objects.equals(_orderedVariableNames, that._orderedVariableNames) && Objects.equals(_tags, that._tags) && Objects.equals(_variables, that._variables); } InstanceData(); @JsonProperty(BfConsts.PROP_DESCRIPTION) String getDescription(); @JsonProperty(BfConsts.PROP_INSTANCE_NAME) String getInstanceName(); @JsonProperty(BfConsts.PROP_LONG_DESCRIPTION) String getLongDescription(); @JsonProperty(BfConsts.PROP_ORDERED_VARIABLE_NAMES) @Nonnull List<String> getOrderedVariableNames(); @JsonProperty(BfConsts.PROP_TAGS) SortedSet<String> getTags(); @JsonProperty(BfConsts.PROP_VARIABLES) SortedMap<String, Variable> getVariables(); @JsonProperty(BfConsts.PROP_DESCRIPTION) void setDescription(String description); @JsonProperty(BfConsts.PROP_INSTANCE_NAME) void setInstanceName(String instanceName); @JsonProperty(BfConsts.PROP_LONG_DESCRIPTION) void setLongDescription(String longDescription); @JsonProperty(BfConsts.PROP_ORDERED_VARIABLE_NAMES) void setOrderedVariableNames(@Nullable Iterable<String> orderedVariableNames); @JsonProperty(BfConsts.PROP_TAGS) void setTags(SortedSet<String> tags); @JsonProperty(BfConsts.PROP_VARIABLES) void setVariables(SortedMap<String, Variable> variables); @Override boolean equals(Object o); @Override int hashCode(); }
InstanceData { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } InstanceData that = (InstanceData) o; return Objects.equals(_description, that._description) && Objects.equals(_instanceName, that._instanceName) && Objects.equals(_longDescription, that._longDescription) && Objects.equals(_orderedVariableNames, that._orderedVariableNames) && Objects.equals(_tags, that._tags) && Objects.equals(_variables, that._variables); } InstanceData(); @JsonProperty(BfConsts.PROP_DESCRIPTION) String getDescription(); @JsonProperty(BfConsts.PROP_INSTANCE_NAME) String getInstanceName(); @JsonProperty(BfConsts.PROP_LONG_DESCRIPTION) String getLongDescription(); @JsonProperty(BfConsts.PROP_ORDERED_VARIABLE_NAMES) @Nonnull List<String> getOrderedVariableNames(); @JsonProperty(BfConsts.PROP_TAGS) SortedSet<String> getTags(); @JsonProperty(BfConsts.PROP_VARIABLES) SortedMap<String, Variable> getVariables(); @JsonProperty(BfConsts.PROP_DESCRIPTION) void setDescription(String description); @JsonProperty(BfConsts.PROP_INSTANCE_NAME) void setInstanceName(String instanceName); @JsonProperty(BfConsts.PROP_LONG_DESCRIPTION) void setLongDescription(String longDescription); @JsonProperty(BfConsts.PROP_ORDERED_VARIABLE_NAMES) void setOrderedVariableNames(@Nullable Iterable<String> orderedVariableNames); @JsonProperty(BfConsts.PROP_TAGS) void setTags(SortedSet<String> tags); @JsonProperty(BfConsts.PROP_VARIABLES) void setVariables(SortedMap<String, Variable> variables); @Override boolean equals(Object o); @Override int hashCode();  }