### Question:
AbstractRollupStat { @Override public boolean equals(Object otherObject) { if (!(otherObject instanceof AbstractRollupStat)) { return false; } AbstractRollupStat other = (AbstractRollupStat)otherObject; if (this.isFloatingPoint != other.isFloatingPoint()) { return false; } if (this.isFloatingPoint) { return this.toDouble() == other.toDouble(); } else { return this.toLong() == other.toLong(); } } AbstractRollupStat(); boolean isFloatingPoint(); double toDouble(); long toLong(); @Override boolean equals(Object otherObject); void setLongValue(long value); void setDoubleValue(double value); abstract byte getStatType(); String toString(); static void set(AbstractRollupStat stat, Number value);  }### Answer:
@Test public void statsAreEqualIfTheirLongNumericalValuesAreEqual() { SimpleStat a = new SimpleStat(123L); SimpleStat b = new SimpleStat(123L); assertTrue(a.equals(b)); assertTrue(b.equals(a)); }
@Test public void statsAreNotEqualIfTheirLongNumericalValuesAreNotEqual() { SimpleStat a = new SimpleStat(123L); SimpleStat b = new SimpleStat(124L); assertFalse(a.equals(b)); assertFalse(b.equals(a)); }
@Test public void statsAreEqualIfTheirDoubleNumericalValuesAreEqual() { SimpleStat a = new SimpleStat(123.45d); SimpleStat b = new SimpleStat(123.45d); assertTrue(a.equals(b)); assertTrue(b.equals(a)); }
@Test public void statsAreNotEqualIfTheirDoubleNumericalValuesAreNotEqual() { SimpleStat a = new SimpleStat(123.45d); SimpleStat b = new SimpleStat(123.7d); assertFalse(a.equals(b)); assertFalse(b.equals(a)); }
@Test public void floatingPointAndNonFloatingPointAreNotEqual() { SimpleStat a = new SimpleStat(123L); SimpleStat b = new SimpleStat(123.45d); assertFalse(a.equals(b)); assertFalse(b.equals(a)); }
@Test public void differentSubtypesAreEqualIfTheirLongNumericalValuesAreEqual() { MinValue min = new MinValue(123L); MaxValue max = new MaxValue(123L); assertTrue(min.equals(max)); assertTrue(max.equals(min)); }
@Test public void differentSubtypesAreNotEqualIfTheirLongNumericalValuesAreNotEqual() { MinValue min = new MinValue(123L); MaxValue max = new MaxValue(124L); assertFalse(min.equals(max)); assertFalse(max.equals(min)); }
@Test public void differentSubtypesAreEqualIfTheirDoubleNumericalValuesAreEqual() { MinValue min = new MinValue(123.45d); MaxValue max = new MaxValue(123.45d); assertTrue(min.equals(max)); assertTrue(max.equals(min)); }
@Test public void differentSubtypesAreNotEqualIfTheirDoubleNumericalValuesAreNotEqual() { MinValue min = new MinValue(123.45d); MaxValue max = new MaxValue(123.7d); assertFalse(min.equals(max)); assertFalse(max.equals(min)); }
@Test public void notEqualToOtherNonStatTypes() { SimpleStat stat = new SimpleStat(); String other = "something"; assertFalse(stat.equals(other)); assertFalse(other.equals(stat)); }