11import org .junit .jupiter .api .Disabled ;
2+ import org .junit .jupiter .api .DisplayName ;
23import org .junit .jupiter .api .Test ;
34
45import java .util .List ;
@@ -10,150 +11,175 @@ public class DnDCharacterTest {
1011 private DnDCharacter dndCharacter = new DnDCharacter ();
1112
1213 @ Test
14+ @ DisplayName ("ability modifier for score 3 is -4" )
1315 public void testAbilityModifierForScore3IsNegative4 () {
1416 assertThat (dndCharacter .modifier (3 )).isEqualTo (-4 );
1517 }
1618
1719 @ Disabled ("Remove to run test" )
1820 @ Test
21+ @ DisplayName ("ability modifier for score 4 is -3" )
1922 public void testAbilityModifierForScore4IsNegative3 () {
2023 assertThat (dndCharacter .modifier (4 )).isEqualTo (-3 );
2124 }
2225
2326 @ Disabled ("Remove to run test" )
2427 @ Test
28+ @ DisplayName ("ability modifier for score 5 is -3" )
2529 public void testAbilityModifierForScore5IsNegative3 () {
2630 assertThat (dndCharacter .modifier (5 )).isEqualTo (-3 );
2731 }
2832
2933 @ Disabled ("Remove to run test" )
3034 @ Test
35+ @ DisplayName ("ability modifier for score 6 is -2" )
3136 public void testAbilityModifierForScore6IsNegative2 () {
3237 assertThat (dndCharacter .modifier (6 )).isEqualTo (-2 );
3338 }
3439
3540 @ Disabled ("Remove to run test" )
3641 @ Test
42+ @ DisplayName ("ability modifier for score 7 is -2" )
3743 public void testAbilityModifierForScore7IsNegative2 () {
3844 assertThat (dndCharacter .modifier (7 )).isEqualTo (-2 );
3945 }
4046
4147 @ Disabled ("Remove to run test" )
4248 @ Test
49+ @ DisplayName ("ability modifier for score 8 is -1" )
4350 public void testAbilityModifierForScore8IsNegative1 () {
4451 assertThat (dndCharacter .modifier (8 )).isEqualTo (-1 );
4552 }
4653
4754 @ Disabled ("Remove to run test" )
4855 @ Test
56+ @ DisplayName ("ability modifier for score 9 is -1" )
4957 public void testAbilityModifierForScore9IsNegative1 () {
5058 assertThat (dndCharacter .modifier (9 )).isEqualTo (-1 );
5159 }
5260
5361 @ Disabled ("Remove to run test" )
5462 @ Test
63+ @ DisplayName ("ability modifier for score 10 is 0" )
5564 public void testAbilityModifierForScore10Is0 () {
5665 assertThat (dndCharacter .modifier (10 )).isEqualTo (0 );
5766 }
5867
5968 @ Disabled ("Remove to run test" )
6069 @ Test
70+ @ DisplayName ("ability modifier for score 11 is 0" )
6171 public void testAbilityModifierForScore11Is0 () {
6272 assertThat (dndCharacter .modifier (11 )).isEqualTo (0 );
6373 }
6474
6575 @ Disabled ("Remove to run test" )
6676 @ Test
77+ @ DisplayName ("ability modifier for score 12 is +1" )
6778 public void testAbilityModifierForScore12Is1 () {
6879 assertThat (dndCharacter .modifier (12 )).isEqualTo (1 );
6980 }
7081
7182 @ Disabled ("Remove to run test" )
7283 @ Test
84+ @ DisplayName ("ability modifier for score 13 is +1" )
7385 public void testAbilityModifierForScore13Is1 () {
7486 assertThat (dndCharacter .modifier (13 )).isEqualTo (1 );
7587 }
7688
7789 @ Disabled ("Remove to run test" )
7890 @ Test
91+ @ DisplayName ("ability modifier for score 14 is +2" )
7992 public void testAbilityModifierForScore14Is2 () {
8093 assertThat (dndCharacter .modifier (14 )).isEqualTo (2 );
8194 }
8295
8396 @ Disabled ("Remove to run test" )
8497 @ Test
98+ @ DisplayName ("ability modifier for score 15 is +2" )
8599 public void testAbilityModifierForScore15Is2 () {
86100 assertThat (dndCharacter .modifier (15 )).isEqualTo (2 );
87101 }
88102
89103 @ Disabled ("Remove to run test" )
90104 @ Test
105+ @ DisplayName ("ability modifier for score 16 is +3" )
91106 public void testAbilityModifierForScore16Is3 () {
92107 assertThat (dndCharacter .modifier (16 )).isEqualTo (3 );
93108 }
94109
95110 @ Disabled ("Remove to run test" )
96111 @ Test
112+ @ DisplayName ("ability modifier for score 17 is +3" )
97113 public void testAbilityModifierForScore17Is3 () {
98114 assertThat (dndCharacter .modifier (17 )).isEqualTo (3 );
99115 }
100116
101117 @ Disabled ("Remove to run test" )
102118 @ Test
119+ @ DisplayName ("ability modifier for score 18 is +4" )
103120 public void testAbilityModifierForScore18Is4 () {
104121 assertThat (dndCharacter .modifier (18 )).isEqualTo (4 );
105122 }
106123
107124 @ Disabled ("Remove to run test" )
108125 @ Test
126+ @ DisplayName ("Rolling uses 4 dice" )
109127 public void test4DiceWereUsedForRollingScores () {
110128 assertThat (dndCharacter .rollDice ().size ()).isEqualTo (4 );
111129 }
112130
113131 @ Disabled ("Remove to run test" )
114132 @ Test
133+ @ DisplayName ("Dice values are between 1 and 6 inclusive" )
115134 public void testDiceValuesBetween1And6 () {
116135 assertThat (dndCharacter .rollDice ()).allMatch (d -> d >= 1 && d <= 6 );
117136 }
118137
119138 @ Disabled ("Remove to run test" )
120139 @ Test
140+ @ DisplayName ("Ability uses 3 largest numbers from scores in descending order" )
121141 public void testAbilityCalculationsUses3LargestNumbersFromScoresInDescendingOrder () {
122142 assertThat (dndCharacter .ability (List .of (4 , 3 , 2 , 1 ))).isEqualTo (9 );
123143 }
124144
125145 @ Disabled ("Remove to run test" )
126146 @ Test
147+ @ DisplayName ("Ability uses 3 largest numbers from scores in ascending order" )
127148 public void testAbilityCalculationsUses3LargestNumbersFromFromScoresInAscendingOrder () {
128149 assertThat (dndCharacter .ability (List .of (1 , 2 , 3 , 4 ))).isEqualTo (9 );
129150 }
130151
131152 @ Disabled ("Remove to run test" )
132153 @ Test
154+ @ DisplayName ("Ability uses 3 largest numbers from scores in random order" )
133155 public void testAbilityCalculationsUses3LargestNumbersFromScoresInRandomOrder () {
134156 assertThat (dndCharacter .ability (List .of (2 , 4 , 3 , 1 ))).isEqualTo (9 );
135157 }
136158
137159 @ Disabled ("Remove to run test" )
138160 @ Test
161+ @ DisplayName ("Ability with all lowest equal numbers yields 3" )
139162 public void testAbilityCalculationsWithLowestEqualNumbers () {
140163 assertThat (dndCharacter .ability (List .of (1 , 1 , 1 , 1 ))).isEqualTo (3 );
141164 }
142165
143166 @ Disabled ("Remove to run test" )
144167 @ Test
168+ @ DisplayName ("Ability with all highest equal numbers yields 18" )
145169 public void testAbilityCalculationsWithHighestEqualNumbers () {
146170 assertThat (dndCharacter .ability (List .of (6 , 6 , 6 , 6 ))).isEqualTo (18 );
147171 }
148172
149173 @ Disabled ("Remove to run test" )
150174 @ Test
175+ @ DisplayName ("Ability calculation with two lowest numbers" )
151176 public void testAbilityCalculationsWithTwoLowestNumbers () {
152177 assertThat (dndCharacter .ability (List .of (3 , 5 , 3 , 4 ))).isEqualTo (12 );
153178 }
154179
155180 @ Disabled ("Remove to run test" )
156181 @ Test
182+ @ DisplayName ("Ability calculation does not mutate input scores" )
157183 public void testAbilityCalculationDoesNotChangeInputScores () {
158184 List <Integer > scores = List .of (1 , 2 , 3 , 4 );
159185 dndCharacter .ability (scores );
@@ -164,6 +190,7 @@ public void testAbilityCalculationDoesNotChangeInputScores() {
164190
165191 @ Disabled ("Remove to run test" )
166192 @ Test
193+ @ DisplayName ("random character is valid" )
167194 public void testRandomCharacterIsValid () {
168195 for (int i = 0 ; i < 1000 ; i ++) {
169196 DnDCharacter character = new DnDCharacter ();
@@ -179,6 +206,7 @@ public void testRandomCharacterIsValid() {
179206
180207 @ Disabled ("Remove to run test" )
181208 @ Test
209+ @ DisplayName ("each ability is only calculated once" )
182210 public void testEachAbilityIsOnlyCalculatedOnce () {
183211 assertThat (dndCharacter .getStrength ()).isEqualTo (dndCharacter .getStrength ());
184212 assertThat (dndCharacter .getDexterity ()).isEqualTo (dndCharacter .getDexterity ());
@@ -190,6 +218,7 @@ public void testEachAbilityIsOnlyCalculatedOnce() {
190218
191219 @ Disabled ("Remove to run test" )
192220 @ Test
221+ @ DisplayName ("Each randomly created character should be unique in attributes" )
193222 public void testUniqueCharacterIsCreated () {
194223 DnDCharacter uniqueDnDCharacter = new DnDCharacter ();
195224 for (int i = 0 ; i < 1000 ; i ++) {
0 commit comments