File tree Expand file tree Collapse file tree 3 files changed +1
-9
lines changed
main/java/com/iluwatar/value/object
test/java/com/iluwatar/value/object Expand file tree Collapse file tree 3 files changed +1
-9
lines changed Original file line number Diff line number Diff line change 1414 *
1515 * For more specific and strict rules to implement value objects check the rules from Stephen
1616 * Colebourne's term VALJO : http://blog.joda.org/2014/03/valjos-value-java-objects.html
17- *
1817 */
1918public class App {
2019 /**
21- *
2220 * This practice creates three HeroStats(Value object) and checks equality between those.
2321 */
2422 public static void main (String [] args ) {
Original file line number Diff line number Diff line change 77 */
88public class HeroStat {
99
10-
1110 // Stats for a hero
1211
1312 private final int strength ;
1413 private final int intelligence ;
1514 private final int luck ;
1615
17-
1816 // All constructors must be private.
1917 private HeroStat (int strength , int intelligence , int luck ) {
2018 super ();
@@ -87,7 +85,6 @@ public boolean equals(Object obj) {
8785 return true ;
8886 }
8987
90-
9188 // The clone() method should not be public. Just don't override it.
9289
9390}
Original file line number Diff line number Diff line change 1515public class HeroStatTest {
1616
1717 /**
18- * Tester for equals() and hashCode() methods of a class. Using guava's EqualsTester
18+ * Tester for equals() and hashCode() methods of a class. Using guava's EqualsTester.
1919 *
2020 * @see http://static.javadoc.io/com.google.guava/guava-testlib/19.0/com/google/common/testing/
2121 * EqualsTester.html
@@ -33,15 +33,12 @@ public void testEquals() {
3333 */
3434 @ Test
3535 public void testToString () {
36-
3736 HeroStat heroStatA = HeroStat .valueOf (3 , 9 , 2 );
3837 HeroStat heroStatB = HeroStat .valueOf (3 , 9 , 2 );
3938 HeroStat heroStatC = HeroStat .valueOf (3 , 9 , 8 );
4039
4140 assertThat (heroStatA .toString (), is (heroStatB .toString ()));
4241 assertThat (heroStatA .toString (), is (not (heroStatC .toString ())));
43-
44-
4542 }
4643
4744}
You can’t perform that action at this time.
0 commit comments