|
23 | 23 | */ |
24 | 24 | package com.tupilabs.human_name_parser; |
25 | 25 |
|
26 | | -import static org.junit.Assert.assertEquals; |
27 | | -import static org.junit.Assert.assertFalse; |
28 | | -import static org.junit.Assert.assertTrue; |
| 26 | +import static org.junit.jupiter.api.Assertions.assertEquals; |
| 27 | +import static org.junit.jupiter.api.Assertions.assertFalse; |
| 28 | +import static org.junit.jupiter.api.Assertions.assertThrows; |
| 29 | +import static org.junit.jupiter.api.Assertions.assertTrue; |
29 | 30 |
|
30 | 31 | import java.util.Arrays; |
31 | 32 |
|
32 | | -import org.junit.Test; |
| 33 | +import org.junit.jupiter.api.Test; |
33 | 34 |
|
34 | 35 | /** |
35 | 36 | * Tests for the {@code HumanNameParserBuilder}. |
@@ -142,54 +143,54 @@ public void testExtraSalutations() { |
142 | 143 |
|
143 | 144 | // validations |
144 | 145 |
|
145 | | - @Test(expected = NullPointerException.class) |
| 146 | + @Test |
146 | 147 | public void testConstructorFailsWithNullString() { |
147 | | - new HumanNameParserBuilder((String) null); |
| 148 | + assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder((String) null)); |
148 | 149 | } |
149 | 150 |
|
150 | | - @Test(expected = NullPointerException.class) |
| 151 | + @Test |
151 | 152 | public void testConstructorFailsWithNullName() { |
152 | | - new HumanNameParserBuilder((Name) null); |
| 153 | + assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder((Name) null)); |
153 | 154 | } |
154 | 155 |
|
155 | | - @Test(expected = NullPointerException.class) |
| 156 | + @Test |
156 | 157 | public void testFailsToBuildWithNullSalutations1() { |
157 | | - new HumanNameParserBuilder("john paul").withSalutations(null).build(); |
| 158 | + assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder("john paul").withSalutations(null).build()); |
158 | 159 | } |
159 | 160 |
|
160 | | - @Test(expected = NullPointerException.class) |
| 161 | + @Test |
161 | 162 | public void testFailsToBuildWithNullSalutations2() { |
162 | | - new HumanNameParserBuilder("john paul").withExtraSalutations(null).build(); |
| 163 | + assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder("john paul").withExtraSalutations(null).build()); |
163 | 164 | } |
164 | 165 |
|
165 | | - @Test(expected = NullPointerException.class) |
| 166 | + @Test |
166 | 167 | public void testFailsToBuildWithNullPostnominals1() { |
167 | | - new HumanNameParserBuilder("john paul").withPostnominals(null).build(); |
| 168 | + assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder("john paul").withPostnominals(null).build()); |
168 | 169 | } |
169 | 170 |
|
170 | | - @Test(expected = NullPointerException.class) |
| 171 | + @Test |
171 | 172 | public void testFailsToBuildWithNullPostnominals2() { |
172 | | - new HumanNameParserBuilder("john paul").withExtraPostnominals(null).build(); |
| 173 | + assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder("john paul").withExtraPostnominals(null).build()); |
173 | 174 | } |
174 | 175 |
|
175 | | - @Test(expected = NullPointerException.class) |
| 176 | + @Test |
176 | 177 | public void testFailsToBuildWithNullSuffixes1() { |
177 | | - new HumanNameParserBuilder("john paul").withSuffixes(null).build(); |
| 178 | + assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder("john paul").withSuffixes(null).build()); |
178 | 179 | } |
179 | 180 |
|
180 | | - @Test(expected = NullPointerException.class) |
| 181 | + @Test |
181 | 182 | public void testFailsToBuildWithNullSuffixes2() { |
182 | | - new HumanNameParserBuilder("john paul").withExtraSuffixes(null).build(); |
| 183 | + assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder("john paul").withExtraSuffixes(null).build()); |
183 | 184 | } |
184 | 185 |
|
185 | | - @Test(expected = NullPointerException.class) |
| 186 | + @Test |
186 | 187 | public void testFailsToBuildWithNullPrefixes1() { |
187 | | - new HumanNameParserBuilder("john paul").withPrefixes(null).build(); |
| 188 | + assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder("john paul").withPrefixes(null).build()); |
188 | 189 | } |
189 | 190 |
|
190 | | - @Test(expected = NullPointerException.class) |
| 191 | + @Test |
191 | 192 | public void testFailsToBuildWithNullPrefixes2() { |
192 | | - new HumanNameParserBuilder("john paul").withExtraPrefixes(null).build(); |
| 193 | + assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder("john paul").withExtraPrefixes(null).build()); |
193 | 194 | } |
194 | 195 |
|
195 | 196 | @Test |
|
0 commit comments