@Test @SuppressWarnings({"ConstantConditions", "ObjectEqualsNull"}) void testEquals() { PropertyValidationRule rule = new PropertyValidationRule("name", "string"); assertAll("Basic equals properties", () -> assertTrue(!rule.equals(null), "PropertyValidationRule must not be equal to null"), () -> assertTrue(!rule.equals(new Object()), "PropertyValidationRule must not be equal to another type"), () -> assertEquals(rule, rule, "PropertyValidationRule must be equal to itself")); PropertyValidationRule differentName = new PropertyValidationRule("badName", "string"); PropertyValidationRule differentType = new PropertyValidationRule("name", "unknown"); PropertyValidationRule sameRule = new PropertyValidationRule("name", "string"); assertAll("Verify against other created objects", () -> assertNotEquals(differentName, rule), () -> assertNotEquals(differentType, rule), () -> assertEquals(sameRule, rule)); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof PropertyValidationRule)) { return false; } PropertyValidationRule other = (PropertyValidationRule) obj; return Objects.equals(this.name, other.name) && Objects.equals(this.type, other.type); }
PropertyValidationRule { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof PropertyValidationRule)) { return false; } PropertyValidationRule other = (PropertyValidationRule) obj; return Objects.equals(this.name, other.name) && Objects.equals(this.type, other.type); } }
PropertyValidationRule { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof PropertyValidationRule)) { return false; } PropertyValidationRule other = (PropertyValidationRule) obj; return Objects.equals(this.name, other.name) && Objects.equals(this.type, other.type); } PropertyValidationRule(@JsonProperty("name") String name,
                                @JsonProperty("type") String type); }
PropertyValidationRule { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof PropertyValidationRule)) { return false; } PropertyValidationRule other = (PropertyValidationRule) obj; return Objects.equals(this.name, other.name) && Objects.equals(this.type, other.type); } PropertyValidationRule(@JsonProperty("name") String name,
                                @JsonProperty("type") String type); String getName(); Class<?> getType(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); }
PropertyValidationRule { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof PropertyValidationRule)) { return false; } PropertyValidationRule other = (PropertyValidationRule) obj; return Objects.equals(this.name, other.name) && Objects.equals(this.type, other.type); } PropertyValidationRule(@JsonProperty("name") String name,
                                @JsonProperty("type") String type); String getName(); Class<?> getType(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }