Type { @Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof Type)) { return false; } Type that = (Type) other; return Objects.equals(key, that.getKey()) && Objects.equals(value, that.getValue()) && Objects.equals(min, that.getMin()) && Objects.equals(max, that.getMax()); } Type(BaseType key);  Type(BaseType key, BaseType value, Long min, Long max); BaseType getKey(); BaseType getValue(); Long getMin(); Long getMax(); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString();  }
@Test public void testEquals() { BaseType key = mock(BaseType.class); BaseType value = mock(BaseType.class); new EqualsTester() .addEqualityGroup(new Type(key), new Type(key, null, null, null)) .addEqualityGroup(new Type(key, value, null, null), new Type(key, value, null, null)) .addEqualityGroup(new Type(key, value, 12L, 34L), new Type(key, value, 12L, 34L)) .testEquals(); }