@Test public void testEquals() { SelfDescribingObject group1Elem1 = new SelfDescribingObject("a", Schema.BOOLEAN, false); SelfDescribingObject group1Elem2 = new SelfDescribingObject("a", Schema.BOOLEAN, false); SelfDescribingObject group2 = new SelfDescribingObject("a", Schema.BOOLEAN, true); SelfDescribingObject group3 = new SelfDescribingObject("a", Schema.NODE, null); SelfDescribingObject group4 = new SelfDescribingObject("b", Schema.BOOLEAN, false); new EqualsTester() .addEqualityGroup(group1Elem1, group1Elem2) .addEqualityGroup(group2) .addEqualityGroup(group3) .addEqualityGroup(group4) .testEquals(); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof SelfDescribingObject)) { return false; } SelfDescribingObject rhs = (SelfDescribingObject) obj; return Objects.equals(_name, rhs._name) && _schema.equals(rhs._schema) && Objects.equals(_value, rhs._value); }
SelfDescribingObject { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof SelfDescribingObject)) { return false; } SelfDescribingObject rhs = (SelfDescribingObject) obj; return Objects.equals(_name, rhs._name) && _schema.equals(rhs._schema) && Objects.equals(_value, rhs._value); } }
SelfDescribingObject { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof SelfDescribingObject)) { return false; } SelfDescribingObject rhs = (SelfDescribingObject) obj; return Objects.equals(_name, rhs._name) && _schema.equals(rhs._schema) && Objects.equals(_value, rhs._value); } SelfDescribingObject(Schema schema, @Nullable Object value);  SelfDescribingObject(@Nullable String name, Schema schema, @Nullable Object value); }
SelfDescribingObject { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof SelfDescribingObject)) { return false; } SelfDescribingObject rhs = (SelfDescribingObject) obj; return Objects.equals(_name, rhs._name) && _schema.equals(rhs._schema) && Objects.equals(_value, rhs._value); } SelfDescribingObject(Schema schema, @Nullable Object value);  SelfDescribingObject(@Nullable String name, Schema schema, @Nullable Object value); @Override boolean equals(Object obj); @Nullable @JsonProperty(PROP_NAME) String getName(); @Nonnull @JsonProperty(PROP_SCHEMA) Schema getSchema(); @Nullable @JsonProperty(PROP_VALUE) Object getValue(); @JsonIgnore Object getTypedValue(); @Override int hashCode(); @Override String toString(); }
SelfDescribingObject { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof SelfDescribingObject)) { return false; } SelfDescribingObject rhs = (SelfDescribingObject) obj; return Objects.equals(_name, rhs._name) && _schema.equals(rhs._schema) && Objects.equals(_value, rhs._value); } SelfDescribingObject(Schema schema, @Nullable Object value);  SelfDescribingObject(@Nullable String name, Schema schema, @Nullable Object value); @Override boolean equals(Object obj); @Nullable @JsonProperty(PROP_NAME) String getName(); @Nonnull @JsonProperty(PROP_SCHEMA) Schema getSchema(); @Nullable @JsonProperty(PROP_VALUE) Object getValue(); @JsonIgnore Object getTypedValue(); @Override int hashCode(); @Override String toString();  }