HeroStat { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } HeroStat other = (HeroStat) obj; if (intelligence != other.intelligence) { return false; } if (luck != other.luck) { return false; } if (strength != other.strength) { return false; } return true; } private  HeroStat(int strength, int intelligence, int luck); static HeroStat valueOf(int strength, int intelligence, int luck); int getStrength(); int getIntelligence(); int getLuck(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testEquals() { HeroStat heroStatA = HeroStat.valueOf(3, 9, 2); HeroStat heroStatB = HeroStat.valueOf(3, 9, 2); new EqualsTester().addEqualityGroup(heroStatA, heroStatB).testEquals(); }