Added comments in the code. modified index.md
This commit is contained in:
@ -1,5 +1,10 @@
|
||||
package com.iluwatar.value.object;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.not;
|
||||
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import com.google.common.testing.EqualsTester;
|
||||
|
||||
import org.junit.Test;
|
||||
@ -11,6 +16,7 @@ public class HeroStatTest {
|
||||
|
||||
/**
|
||||
* Tester for equals() and hashCode() methods of a class.
|
||||
*
|
||||
* @see http://www.javadoc.io/doc/com.google.guava/guava-testlib/19.0
|
||||
*/
|
||||
@Test
|
||||
@ -20,4 +26,21 @@ public class HeroStatTest {
|
||||
new EqualsTester().addEqualityGroup(heroStatA, heroStatB).testEquals();
|
||||
}
|
||||
|
||||
/**
|
||||
* The toString() for two equal values must be the same. For two non-equal values it must be
|
||||
* different.
|
||||
*/
|
||||
@Test
|
||||
public void testToString() {
|
||||
|
||||
HeroStat heroStatA = HeroStat.valueOf(3, 9, 2);
|
||||
HeroStat heroStatB = HeroStat.valueOf(3, 9, 2);
|
||||
HeroStat heroStatC = HeroStat.valueOf(3, 9, 8);
|
||||
|
||||
assertThat(heroStatA.toString(), is(heroStatB.toString()));
|
||||
assertThat(heroStatA.toString(), is(not(heroStatC.toString())));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user