@Test @SuppressWarnings({"ConstantConditions", "ObjectEqualsNull"}) void testEquals() { Key key = new Key("testName", "testSecret"); assertAll("Basic equals properties", () -> assertFalse(key.equals(null), "Key must not be equal to null"), () -> assertFalse(key.equals(new Object()), "Key must not be equal to another type"), () -> assertEquals(key, key, "Key must be equal to itself")); Key differentName = new Key("badName", "testSecret"); Key differentSecret = new Key("testName", "badSecret"); Key sameKey = new Key("testName", "testSecret"); assertAll("Verify against other created objects", () -> assertNotEquals(differentName, key), () -> assertNotEquals(differentSecret, key), () -> assertEquals(sameKey, key)); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Key)) { return false; } Key other = (Key) obj; return Objects.equals(this.name, other.name) && Objects.equals(this.secret, other.secret); }
Key implements Principal { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Key)) { return false; } Key other = (Key) obj; return Objects.equals(this.name, other.name) && Objects.equals(this.secret, other.secret); } }
Key implements Principal { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Key)) { return false; } Key other = (Key) obj; return Objects.equals(this.name, other.name) && Objects.equals(this.secret, other.secret); } Key(@JsonProperty("application") String name,
             @JsonProperty("secret") String secret); }
Key implements Principal { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Key)) { return false; } Key other = (Key) obj; return Objects.equals(this.name, other.name) && Objects.equals(this.secret, other.secret); } Key(@JsonProperty("application") String name,
             @JsonProperty("secret") String secret); String getName(); String getSecret(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); }
Key implements Principal { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Key)) { return false; } Key other = (Key) obj; return Objects.equals(this.name, other.name) && Objects.equals(this.secret, other.secret); } Key(@JsonProperty("application") String name,
             @JsonProperty("secret") String secret); String getName(); String getSecret(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }