|
1 | 1 | import org.junit.Ignore; |
2 | 2 | import org.junit.Test; |
3 | 3 |
|
4 | | -import static org.junit.Assert.assertEquals; |
| 4 | +import static org.assertj.core.api.Assertions.assertThat; |
5 | 5 |
|
6 | 6 | public class ClockCreationTest { |
7 | 7 |
|
8 | 8 | @Test |
9 | 9 | public void canPrintTimeOnTheHour() { |
10 | | - assertEquals("08:00", new Clock(8, 0).toString()); |
| 10 | + assertThat(new Clock(8, 0).toString()).isEqualTo("08:00"); |
11 | 11 | } |
12 | 12 |
|
13 | 13 | @Ignore("Remove to run test") |
14 | 14 | @Test |
15 | 15 | public void canPrintTimeWithMinutes() { |
16 | | - assertEquals("11:09", new Clock(11, 9).toString()); |
| 16 | + assertThat(new Clock(11, 9).toString()).isEqualTo("11:09"); |
17 | 17 | } |
18 | 18 |
|
19 | 19 | @Ignore("Remove to run test") |
20 | 20 | @Test |
21 | 21 | public void midnightPrintsAsZero() { |
22 | | - assertEquals("00:00", new Clock(24, 0).toString()); |
| 22 | + assertThat(new Clock(24, 0).toString()).isEqualTo("00:00"); |
23 | 23 | } |
24 | 24 |
|
25 | 25 | @Ignore("Remove to run test") |
26 | 26 | @Test |
27 | 27 | public void hourRollsOver() { |
28 | | - assertEquals("01:00", new Clock(25, 0).toString()); |
| 28 | + assertThat(new Clock(25, 0).toString()).isEqualTo("01:00"); |
29 | 29 | } |
30 | 30 |
|
31 | 31 | @Ignore("Remove to run test") |
32 | 32 | @Test |
33 | 33 | public void hourRollsOverContinuously() { |
34 | | - assertEquals("04:00", new Clock(100, 0).toString()); |
| 34 | + assertThat(new Clock(100, 0).toString()).isEqualTo("04:00"); |
35 | 35 | } |
36 | 36 |
|
37 | 37 | @Ignore("Remove to run test") |
38 | 38 | @Test |
39 | 39 | public void sixtyMinutesIsNextHour() { |
40 | | - assertEquals("02:00", new Clock(1, 60).toString()); |
| 40 | + assertThat(new Clock(1, 60).toString()).isEqualTo("02:00"); |
41 | 41 | } |
42 | 42 |
|
43 | 43 | @Ignore("Remove to run test") |
44 | 44 | @Test |
45 | 45 | public void minutesRollOver() { |
46 | | - assertEquals("02:40", new Clock(0, 160).toString()); |
| 46 | + assertThat(new Clock(0, 160).toString()).isEqualTo("02:40"); |
47 | 47 | } |
48 | 48 |
|
49 | 49 | @Ignore("Remove to run test") |
50 | 50 | @Test |
51 | 51 | public void minutesRollOverContinuously() { |
52 | | - assertEquals("04:43", new Clock(0, 1723).toString()); |
| 52 | + assertThat(new Clock(0, 1723).toString()).isEqualTo("04:43"); |
53 | 53 | } |
54 | 54 |
|
55 | 55 | @Ignore("Remove to run test") |
56 | 56 | @Test |
57 | 57 | public void hourAndMinutesRollOver() { |
58 | | - assertEquals("03:40", new Clock(25, 160).toString()); |
| 58 | + assertThat(new Clock(25, 160).toString()).isEqualTo("03:40"); |
59 | 59 | } |
60 | 60 |
|
61 | 61 | @Ignore("Remove to run test") |
62 | 62 | @Test |
63 | 63 | public void hourAndMinutesRollOverContinuously() { |
64 | | - assertEquals("11:01", new Clock(201, 3001).toString()); |
| 64 | + assertThat(new Clock(201, 3001).toString()).isEqualTo("11:01"); |
65 | 65 | } |
66 | 66 |
|
67 | 67 | @Ignore("Remove to run test") |
68 | 68 | @Test |
69 | 69 | public void hourAndMinutesRollOverToExactlyMidnight() { |
70 | | - assertEquals("00:00", new Clock(72, 8640).toString()); |
| 70 | + assertThat(new Clock(72, 8640).toString()).isEqualTo("00:00"); |
71 | 71 | } |
72 | 72 |
|
73 | 73 | @Ignore("Remove to run test") |
74 | 74 | @Test |
75 | 75 | public void negativeHour() { |
76 | | - assertEquals("23:15", new Clock(-1, 15).toString()); |
| 76 | + assertThat(new Clock(-1, 15).toString()).isEqualTo("23:15"); |
77 | 77 | } |
78 | 78 |
|
79 | 79 | @Ignore("Remove to run test") |
80 | 80 | @Test |
81 | 81 | public void negativeHourRollsOver() { |
82 | | - assertEquals("23:00", new Clock(-25, 0).toString()); |
| 82 | + assertThat(new Clock(-25, 0).toString()).isEqualTo("23:00"); |
83 | 83 | } |
84 | 84 |
|
85 | 85 | @Ignore("Remove to run test") |
86 | 86 | @Test |
87 | 87 | public void negativeHourRollsOverContinuously() { |
88 | | - assertEquals("05:00", new Clock(-91, 0).toString()); |
| 88 | + assertThat(new Clock(-91, 0).toString()).isEqualTo("05:00"); |
89 | 89 | } |
90 | 90 |
|
91 | 91 | @Ignore("Remove to run test") |
92 | 92 | @Test |
93 | 93 | public void negativeMinutes() { |
94 | | - assertEquals("00:20", new Clock(1, -40).toString()); |
| 94 | + assertThat(new Clock(1, -40).toString()).isEqualTo("00:20"); |
95 | 95 | } |
96 | 96 |
|
97 | 97 | @Ignore("Remove to run test") |
98 | 98 | @Test |
99 | 99 | public void negativeMinutesRollOver() { |
100 | | - assertEquals("22:20", new Clock(1, -160).toString()); |
| 100 | + assertThat(new Clock(1, -160).toString()).isEqualTo("22:20"); |
101 | 101 | } |
102 | 102 |
|
103 | 103 | @Ignore("Remove to run test") |
104 | 104 | @Test |
105 | 105 | public void negativeMinutesRollOverContinuously() { |
106 | | - assertEquals("16:40", new Clock(1, -4820).toString()); |
| 106 | + assertThat(new Clock(1, -4820).toString()).isEqualTo("16:40"); |
107 | 107 | } |
108 | 108 |
|
109 | 109 | @Ignore("Remove to run test") |
110 | 110 | @Test |
111 | 111 | public void negativeSixtyMinutesIsPreviousHour() { |
112 | | - assertEquals("01:00", new Clock(2, -60).toString()); |
| 112 | + assertThat(new Clock(2, -60).toString()).isEqualTo("01:00"); |
113 | 113 | } |
114 | 114 |
|
115 | 115 | @Ignore("Remove to run test") |
116 | 116 | @Test |
117 | 117 | public void negativeHourAndMinutesBothRollOver() { |
118 | | - assertEquals("20:20", new Clock(-25, -160).toString()); |
| 118 | + assertThat(new Clock(-25, -160).toString()).isEqualTo("20:20"); |
119 | 119 | } |
120 | 120 |
|
121 | 121 | @Ignore("Remove to run test") |
122 | 122 | @Test |
123 | 123 | public void negativeHourAndMinutesBothRollOverContinuously() { |
124 | | - assertEquals("22:10", new Clock(-121, -5810).toString()); |
| 124 | + assertThat(new Clock(-121, -5810).toString()).isEqualTo("22:10"); |
125 | 125 | } |
126 | 126 | } |
0 commit comments