|
1 |
| -import org.junit.Test; |
| 1 | +import org.junit.jupiter.api.DisplayName; |
| 2 | +import org.junit.jupiter.api.Tag; |
| 3 | +import org.junit.jupiter.api.Test; |
2 | 4 |
|
3 |
| -import static org.assertj.core.api.Assertions.assertThat; |
| 5 | +import static org.assertj.core.api.Assertions.*; |
4 | 6 |
|
5 | 7 | public class FighterTest {
|
6 | 8 |
|
7 | 9 | @Test
|
| 10 | + @Tag("task:1") |
| 11 | + @DisplayName("The toString method of the Warrior returns the correct description of the fighter") |
8 | 12 | public void testWarriorToString() {
|
9 | 13 | Fighter warrior = new Warrior();
|
10 | 14 | assertThat(warrior.toString()).isEqualTo("Fighter is a Warrior");
|
11 | 15 | }
|
12 | 16 |
|
13 | 17 | @Test
|
| 18 | + @Tag("task:1") |
| 19 | + @DisplayName("The toString method of the Wizard returns the correct description of the fighter") |
14 | 20 | public void testWizardToString() {
|
15 | 21 | Wizard wizard = new Wizard();
|
16 | 22 | assertThat(wizard.toString()).isEqualTo("Fighter is a Wizard");
|
17 | 23 | }
|
18 | 24 |
|
19 | 25 | @Test
|
20 |
| - public void testFighterVulnerableByDefault() { |
| 26 | + @Tag("task:2") |
| 27 | + @DisplayName("The isVulnerable method of the Warrior returns false by default") |
| 28 | + public void testFighterNotVulnerableByDefault() { |
21 | 29 | Fighter warrior = new Warrior();
|
22 | 30 | assertThat(warrior.isVulnerable()).isFalse();
|
23 | 31 | }
|
24 | 32 |
|
25 | 33 | @Test
|
| 34 | + @Tag("task:3") |
| 35 | + @DisplayName("The prepareSpell method makes the Wizard not vulnerable") |
26 | 36 | public void testWizardVulnerable() {
|
27 | 37 | Wizard wizard = new Wizard();
|
28 |
| - assertThat(wizard.isVulnerable()).isTrue(); |
29 | 38 | wizard.prepareSpell();
|
30 | 39 | assertThat(wizard.isVulnerable()).isFalse();
|
31 | 40 | }
|
32 | 41 |
|
33 | 42 | @Test
|
| 43 | + @Tag("task:4") |
| 44 | + @DisplayName("The isVulnerable method of the Wizard returns true by default") |
| 45 | + public void testWizardVulnerableByDefault() { |
| 46 | + Wizard wizard = new Wizard(); |
| 47 | + assertThat(wizard.isVulnerable()).isTrue(); |
| 48 | + } |
| 49 | + |
| 50 | + @Test |
| 51 | + @Tag("task:4") |
| 52 | + @DisplayName("The damagePoints method of the Wizard returns 3 when spell has not been prepared") |
34 | 53 | public void testWizardsDamagePoints() {
|
35 | 54 | Wizard wizard = new Wizard();
|
36 | 55 | Warrior warrior = new Warrior();
|
37 | 56 | assertThat(wizard.damagePoints(warrior)).isEqualTo(3);
|
| 57 | + } |
| 58 | + |
| 59 | + @Test |
| 60 | + @Tag("task:4") |
| 61 | + @DisplayName("The damagePoints method of the Wizard returns 12 after a spell has been prepared") |
| 62 | + public void testWizardsDamagePointsAfterPreparingSpell() { |
| 63 | + Wizard wizard = new Wizard(); |
| 64 | + Warrior warrior = new Warrior(); |
38 | 65 | wizard.prepareSpell();
|
39 | 66 | assertThat(wizard.damagePoints(warrior)).isEqualTo(12);
|
40 | 67 | }
|
41 | 68 |
|
42 | 69 | @Test
|
43 |
| - public void testWarriorsDamagePoints() { |
| 70 | + @Tag("task:5") |
| 71 | + @DisplayName("The damagePoints method of the Warrior returns 10 when target is vulnerable") |
| 72 | + public void testWarriorsDamagePointsWhenTargetVulnerable() { |
44 | 73 | Warrior warrior = new Warrior();
|
45 | 74 | Wizard wizard = new Wizard();
|
46 | 75 | assertThat(warrior.damagePoints(wizard)).isEqualTo(10);
|
| 76 | + } |
| 77 | + |
| 78 | + @Test |
| 79 | + @Tag("task:5") |
| 80 | + @DisplayName("The damagePoints method of the Warrior returns 6 when target is not vulnerable") |
| 81 | + public void testWarriorsDamagePointsWhenTargetNotVulnerable() { |
| 82 | + Warrior warrior = new Warrior(); |
| 83 | + Wizard wizard = new Wizard(); |
47 | 84 | wizard.prepareSpell();
|
48 | 85 | assertThat(warrior.damagePoints(wizard)).isEqualTo(6);
|
49 | 86 | }
|
|
0 commit comments