|
2 | 2 | import org.junit.Ignore; |
3 | 3 | import org.junit.Before; |
4 | 4 |
|
5 | | -import static org.junit.Assert.*; |
| 5 | +import static org.assertj.core.api.Assertions.assertThat; |
| 6 | + |
6 | 7 |
|
7 | 8 | public class BobTest { |
8 | 9 | private Bob bob; |
9 | 10 |
|
10 | | - |
11 | 11 | @Before |
12 | 12 | public void setUp() { |
13 | 13 | bob = new Bob(); |
14 | 14 | } |
15 | 15 |
|
16 | 16 | @Test |
17 | 17 | public void saySomething() { |
18 | | - assertEquals( |
19 | | - "Whatever.", |
20 | | - bob.hey("Tom-ay-to, tom-aaaah-to.") |
21 | | - ); |
| 18 | + assertThat(bob.hey("Tom-ay-to, tom-aaaah-to.")) |
| 19 | + .isEqualTo("Whatever."); |
22 | 20 | } |
23 | 21 |
|
24 | 22 | @Ignore("Remove to run test") |
25 | 23 | @Test |
26 | 24 | public void shouting() { |
27 | | - assertEquals( |
28 | | - "Whoa, chill out!", |
29 | | - bob.hey("WATCH OUT!") |
30 | | - ); |
| 25 | + assertThat(bob.hey("WATCH OUT!")) |
| 26 | + .isEqualTo("Whoa, chill out!"); |
31 | 27 | } |
32 | 28 |
|
33 | 29 | @Ignore("Remove to run test") |
34 | 30 | @Test |
35 | 31 | public void shoutingGibberish() { |
36 | | - assertEquals( |
37 | | - "Whoa, chill out!", |
38 | | - bob.hey("FCECDFCAAB") |
39 | | - ); |
| 32 | + assertThat(bob.hey("FCECDFCAAB")) |
| 33 | + .isEqualTo("Whoa, chill out!"); |
40 | 34 | } |
41 | 35 |
|
42 | 36 | @Ignore("Remove to run test") |
43 | 37 | @Test |
44 | 38 | public void askingAQuestion() { |
45 | | - assertEquals( |
46 | | - "Sure.", |
47 | | - bob.hey("Does this cryogenic chamber make me look fat?") |
48 | | - ); |
| 39 | + assertThat(bob.hey("Does this cryogenic chamber make me look fat?")) |
| 40 | + .isEqualTo("Sure."); |
49 | 41 | } |
50 | 42 |
|
51 | 43 | @Ignore("Remove to run test") |
52 | 44 | @Test |
53 | 45 | public void askingANumericQuestion() { |
54 | | - assertEquals( |
55 | | - "Sure.", |
56 | | - bob.hey("You are, what, like 15?") |
57 | | - ); |
| 46 | + assertThat(bob.hey("You are, what, like 15?")) |
| 47 | + .isEqualTo("Sure."); |
58 | 48 | } |
59 | 49 |
|
60 | 50 | @Ignore("Remove to run test") |
61 | 51 | @Test |
62 | 52 | public void askingGibberish() { |
63 | | - assertEquals( |
64 | | - "Sure.", |
65 | | - bob.hey("fffbbcbeab?") |
66 | | - ); |
| 53 | + assertThat(bob.hey("fffbbcbeab?")) |
| 54 | + .isEqualTo("Sure."); |
67 | 55 | } |
68 | 56 |
|
69 | 57 | @Ignore("Remove to run test") |
70 | 58 | @Test |
71 | 59 | public void talkingForcefully() { |
72 | | - assertEquals( |
73 | | - "Whatever.", |
74 | | - bob.hey("Hi there!") |
75 | | - ); |
| 60 | + assertThat(bob.hey("Hi there!")) |
| 61 | + .isEqualTo("Whatever."); |
76 | 62 | } |
77 | 63 |
|
78 | 64 | @Ignore("Remove to run test") |
79 | 65 | @Test |
80 | 66 | public void usingAcronymsInRegularSpeech() { |
81 | | - assertEquals( |
82 | | - "Whatever.", bob.hey("It's OK if you don't want to go work for NASA.") |
83 | | - ); |
| 67 | + assertThat(bob.hey("It's OK if you don't want to go work for NASA.")) |
| 68 | + .isEqualTo("Whatever."); |
84 | 69 | } |
85 | 70 |
|
86 | 71 | @Ignore("Remove to run test") |
87 | 72 | @Test |
88 | 73 | public void forcefulQuestions() { |
89 | | - assertEquals( |
90 | | - "Calm down, I know what I'm doing!", bob.hey("WHAT'S GOING ON?") |
91 | | - ); |
| 74 | + assertThat(bob.hey("WHAT'S GOING ON?")) |
| 75 | + .isEqualTo("Calm down, I know what I'm doing!"); |
92 | 76 | } |
93 | 77 |
|
94 | 78 | @Ignore("Remove to run test") |
95 | 79 | @Test |
96 | 80 | public void shoutingNumbers() { |
97 | | - assertEquals( |
98 | | - "Whoa, chill out!", bob.hey("1, 2, 3 GO!") |
99 | | - ); |
| 81 | + assertThat(bob.hey("1, 2, 3 GO!")) |
| 82 | + .isEqualTo("Whoa, chill out!"); |
100 | 83 | } |
101 | 84 |
|
102 | 85 | @Ignore("Remove to run test") |
103 | 86 | @Test |
104 | 87 | public void onlyNumbers() { |
105 | | - assertEquals( |
106 | | - "Whatever.", bob.hey("1, 2, 3") |
107 | | - ); |
| 88 | + assertThat(bob.hey("1, 2, 3")) |
| 89 | + .isEqualTo("Whatever."); |
108 | 90 | } |
109 | 91 |
|
110 | 92 | @Ignore("Remove to run test") |
111 | 93 | @Test |
112 | 94 | public void questionWithOnlyNumbers() { |
113 | | - assertEquals( |
114 | | - "Sure.", bob.hey("4?") |
115 | | - ); |
| 95 | + assertThat(bob.hey("4?")) |
| 96 | + .isEqualTo("Sure."); |
116 | 97 | } |
117 | 98 |
|
118 | 99 | @Ignore("Remove to run test") |
119 | 100 | @Test |
120 | 101 | public void shoutingWithSpecialCharacters() { |
121 | | - assertEquals( |
122 | | - "Whoa, chill out!", bob.hey("ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!") |
123 | | - ); |
| 102 | + assertThat(bob.hey("ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!")) |
| 103 | + .isEqualTo("Whoa, chill out!"); |
124 | 104 | } |
125 | 105 |
|
126 | 106 | @Ignore("Remove to run test") |
127 | 107 | @Test |
128 | 108 | public void shoutingWithNoExclamationMark() { |
129 | | - assertEquals( |
130 | | - "Whoa, chill out!", bob.hey("I HATE THE DENTIST") |
131 | | - ); |
| 109 | + assertThat(bob.hey("I HATE THE DENTIST")) |
| 110 | + .isEqualTo("Whoa, chill out!"); |
132 | 111 | } |
133 | 112 |
|
134 | 113 | @Ignore("Remove to run test") |
135 | 114 | @Test |
136 | 115 | public void statementContainingQuestionMark() { |
137 | | - assertEquals( |
138 | | - "Whatever.", bob.hey("Ending with ? means a question.") |
139 | | - ); |
| 116 | + assertThat(bob.hey("Ending with ? means a question.")) |
| 117 | + .isEqualTo("Whatever."); |
140 | 118 | } |
141 | 119 |
|
142 | 120 | @Ignore("Remove to run test") |
143 | 121 | @Test |
144 | 122 | public void nonLettersWithQuestion() { |
145 | | - assertEquals( |
146 | | - "Sure.", bob.hey(":) ?") |
147 | | - ); |
| 123 | + assertThat(bob.hey(":) ?")) |
| 124 | + .isEqualTo("Sure."); |
148 | 125 | } |
149 | 126 |
|
150 | 127 | @Ignore("Remove to run test") |
151 | 128 | @Test |
152 | 129 | public void prattlingOn() { |
153 | | - assertEquals( |
154 | | - "Sure.", bob.hey("Wait! Hang on. Are you going to be OK?") |
155 | | - ); |
| 130 | + assertThat(bob.hey("Wait! Hang on. Are you going to be OK?")) |
| 131 | + .isEqualTo("Sure."); |
156 | 132 | } |
157 | 133 |
|
158 | 134 | @Ignore("Remove to run test") |
159 | 135 | @Test |
160 | 136 | public void silence() { |
161 | | - assertEquals( |
162 | | - "Fine. Be that way!", bob.hey("") |
163 | | - ); |
| 137 | + assertThat(bob.hey("")) |
| 138 | + .isEqualTo("Fine. Be that way!"); |
164 | 139 | } |
165 | 140 |
|
166 | 141 | @Ignore("Remove to run test") |
167 | 142 | @Test |
168 | 143 | public void prolongedSilence() { |
169 | | - assertEquals( |
170 | | - "Fine. Be that way!", bob.hey(" ") |
171 | | - ); |
| 144 | + assertThat(bob.hey(" ")) |
| 145 | + .isEqualTo("Fine. Be that way!"); |
172 | 146 | } |
173 | 147 |
|
174 | 148 | @Ignore("Remove to run test") |
175 | 149 | @Test |
176 | 150 | public void alternateSilence() { |
177 | | - assertEquals( |
178 | | - "Fine. Be that way!", bob.hey("\t\t\t\t\t\t\t\t\t\t") |
179 | | - ); |
| 151 | + assertThat(bob.hey("\t\t\t\t\t\t\t\t\t\t")) |
| 152 | + .isEqualTo("Fine. Be that way!"); |
180 | 153 | } |
181 | 154 |
|
182 | 155 | @Ignore("Remove to run test") |
183 | 156 | @Test |
184 | 157 | public void multipleLineQuestion() { |
185 | | - assertEquals( |
186 | | - "Whatever.", |
187 | | - bob.hey("\nDoes this cryogenic chamber make me look fat?\nNo.") |
188 | | - ); |
| 158 | + assertThat(bob.hey("\nDoes this cryogenic chamber make me look fat?\nNo.")) |
| 159 | + .isEqualTo("Whatever."); |
189 | 160 | } |
190 | 161 |
|
191 | 162 | @Ignore("Remove to run test") |
192 | 163 | @Test |
193 | 164 | public void startingWithWhitespace() { |
194 | | - assertEquals( |
195 | | - "Whatever.", |
196 | | - bob.hey(" hmmmmmmm...") |
197 | | - ); |
| 165 | + assertThat(bob.hey(" hmmmmmmm...")) |
| 166 | + .isEqualTo("Whatever."); |
198 | 167 | } |
199 | 168 |
|
200 | 169 | @Ignore("Remove to run test") |
201 | 170 | @Test |
202 | 171 | public void endingWithWhiteSpace() { |
203 | | - assertEquals( |
204 | | - "Sure.", |
205 | | - bob.hey("Okay if like my spacebar quite a bit? ") |
206 | | - ); |
| 172 | + assertThat(bob.hey("Okay if like my spacebar quite a bit? ")) |
| 173 | + .isEqualTo("Sure."); |
207 | 174 | } |
208 | 175 |
|
209 | 176 | @Ignore("Remove to run test") |
210 | 177 | @Test |
211 | 178 | public void otherWhiteSpace() { |
212 | | - assertEquals( |
213 | | - "Fine. Be that way!", |
214 | | - bob.hey("\n\r \t") |
215 | | - ); |
| 179 | + assertThat(bob.hey("\n\r \t")) |
| 180 | + .isEqualTo("Fine. Be that way!"); |
216 | 181 | } |
217 | 182 |
|
218 | 183 | @Ignore("Remove to run test") |
219 | 184 | @Test |
220 | 185 | public void nonQuestionEndingWithWhiteSpace() { |
221 | | - assertEquals( |
222 | | - "Whatever.", |
223 | | - bob.hey("This is a statement ending with whitespace ") |
224 | | - ); |
| 186 | + assertThat(bob.hey("This is a statement ending with whitespace ")) |
| 187 | + .isEqualTo("Whatever."); |
225 | 188 | } |
226 | 189 |
|
227 | 190 | } |
0 commit comments