|
1 | 1 | import org.junit.Ignore;
|
2 | 2 | import org.junit.Test;
|
3 | 3 |
|
4 |
| -import static org.assertj.core.api.Assertions.*; |
| 4 | +import static org.assertj.core.api.Assertions.assertThat; |
| 5 | +import static org.junit.Assert.assertThrows; |
5 | 6 |
|
6 | 7 | public class FootballMatchReportsTest {
|
7 | 8 |
|
8 | 9 | @Test
|
9 | 10 | public void test_goal() {
|
10 |
| - assertThat(FootballMatchReports.onField(1).contentEquals("goalie")); |
| 11 | + assertThat(FootballMatchReports.onField(1)).isEqualTo("goalie"); |
11 | 12 | }
|
12 | 13 |
|
13 | 14 | @Test
|
14 | 15 | @Ignore("Remove to run test")
|
15 | 16 | public void test_left_back() {
|
16 |
| - assertThat(FootballMatchReports.onField(2).contentEquals("left back")); |
| 17 | + assertThat(FootballMatchReports.onField(2)).isEqualTo("left back"); |
17 | 18 | }
|
18 | 19 |
|
19 | 20 | @Test
|
20 | 21 | @Ignore("Remove to run test")
|
21 | 22 | public void test_right_back() {
|
22 |
| - assertThat(FootballMatchReports.onField(5).contentEquals("right back")); |
| 23 | + assertThat(FootballMatchReports.onField(5)).isEqualTo("right back"); |
23 | 24 | }
|
24 | 25 |
|
25 | 26 | @Test
|
26 | 27 | @Ignore("Remove to run test")
|
27 | 28 | public void test_center_back() {
|
28 |
| - assertThat(FootballMatchReports.onField(3).contentEquals("center back")); |
29 |
| - assertThat(FootballMatchReports.onField(4).contentEquals("center back")); |
| 29 | + assertThat(FootballMatchReports.onField(3)).isEqualTo("center back"); |
| 30 | + assertThat(FootballMatchReports.onField(4)).isEqualTo("center back"); |
30 | 31 | }
|
31 | 32 |
|
32 | 33 | @Test
|
33 | 34 | @Ignore("Remove to run test")
|
34 | 35 | public void test_midfielder() {
|
35 |
| - assertThat(FootballMatchReports.onField(6).contentEquals("midfielder")); |
36 |
| - assertThat(FootballMatchReports.onField(7).contentEquals("midfielder")); |
37 |
| - assertThat(FootballMatchReports.onField(8).contentEquals("midfielder")); |
| 36 | + assertThat(FootballMatchReports.onField(6)).isEqualTo("midfielder"); |
| 37 | + assertThat(FootballMatchReports.onField(7)).isEqualTo("midfielder"); |
| 38 | + assertThat(FootballMatchReports.onField(8)).isEqualTo("midfielder"); |
38 | 39 | }
|
39 | 40 |
|
40 | 41 | @Test
|
41 | 42 | @Ignore("Remove to run test")
|
42 | 43 | public void test_left_wing() {
|
43 |
| - assertThat(FootballMatchReports.onField(9).contentEquals("left wing")); |
| 44 | + assertThat(FootballMatchReports.onField(9)).isEqualTo("left wing"); |
44 | 45 | }
|
45 | 46 |
|
46 | 47 | @Test
|
47 | 48 | @Ignore("Remove to run test")
|
48 | 49 | public void test_striker() {
|
49 |
| - assertThat(FootballMatchReports.onField(10).contentEquals("striker")); |
| 50 | + assertThat(FootballMatchReports.onField(10)).isEqualTo("striker"); |
50 | 51 | }
|
51 | 52 |
|
52 | 53 | @Test
|
53 | 54 | @Ignore("Remove to run test")
|
54 | 55 | public void test_right_wing() {
|
55 |
| - assertThat(FootballMatchReports.onField(11).contentEquals("right wing")); |
| 56 | + assertThat(FootballMatchReports.onField(11)).isEqualTo("right wing"); |
56 | 57 | }
|
57 | 58 |
|
58 |
| - @Test(expected = IllegalArgumentException.class) |
| 59 | + @Test |
59 | 60 | @Ignore("Remove to run test")
|
60 | 61 | public void test_exception() {
|
61 |
| - FootballMatchReports.onField(13); |
| 62 | + assertThrows( |
| 63 | + IllegalArgumentException.class, |
| 64 | + () -> FootballMatchReports.onField(13)); |
62 | 65 | }
|
63 | 66 |
|
64 |
| - @Test(expected = IllegalArgumentException.class) |
| 67 | + @Test |
65 | 68 | @Ignore("Remove to run test")
|
66 | 69 | public void test_exception_negative_number() {
|
67 |
| - FootballMatchReports.onField(-1); |
| 70 | + assertThrows( |
| 71 | + IllegalArgumentException.class, |
| 72 | + () -> FootballMatchReports.onField(-1)); |
68 | 73 | }
|
69 | 74 | }
|
0 commit comments