@Test public void testEquals() { Temperature tempA = new Temperature(31, TemperatureType.CELSIUS); Temperature tempB = new Temperature(31, TemperatureType.CELSIUS); Temperature tempC = new Temperature(31, TemperatureType.KELVIN); Temperature tempD = new Temperature(31, TemperatureType.FAHRENHEIT); Assert.assertEquals(tempA, tempB); Assert.assertNotEquals(tempA, tempC); Assert.assertNotEquals(tempA, tempD); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Temperature that = (Temperature) o; return Double.compare(that.value, value) == 0 && type == that.type; }
Temperature { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Temperature that = (Temperature) o; return Double.compare(that.value, value) == 0 && type == that.type; } }
Temperature { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Temperature that = (Temperature) o; return Double.compare(that.value, value) == 0 && type == that.type; } @JsonCreator  Temperature(
		@JsonProperty("value") double value,
		@JsonProperty("type") TemperatureType type); }
Temperature { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Temperature that = (Temperature) o; return Double.compare(that.value, value) == 0 && type == that.type; } @JsonCreator  Temperature(
		@JsonProperty("value") double value,
		@JsonProperty("type") TemperatureType type); static Temperature fromKelvin(double value, TemperatureType type); double getValue(); @JsonIgnore double getValueInKelvin(); TemperatureType getType(); @Override boolean equals(Object o); @Override int hashCode(); }
Temperature { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Temperature that = (Temperature) o; return Double.compare(that.value, value) == 0 && type == that.type; } @JsonCreator  Temperature(
		@JsonProperty("value") double value,
		@JsonProperty("type") TemperatureType type); static Temperature fromKelvin(double value, TemperatureType type); double getValue(); @JsonIgnore double getValueInKelvin(); TemperatureType getType(); @Override boolean equals(Object o); @Override int hashCode();  }