Skip to content

Commit c32b06e

Browse files
committed
Merge branch 'pr-15'
This closes #15
2 parents 02584fe + ea238e4 commit c32b06e

File tree

5 files changed

+47
-37
lines changed

5 files changed

+47
-37
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ String nicknames = parser.getNicknames();
5353

5454
## Changelog
5555

56+
### 0.3 (20??-??-??)
57+
58+
- [#15](https://github.com/tupilabs/HumanNameParser.java/pull/15) JUnit Jupiter migration (thanks to @mureinik).
59+
5660
### 0.2 (2020-07-09)
5761

5862
- [#10](https://github.com/tupilabs/HumanNameParser.java/issues/10) support custom

pom.xml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
<properties>
5656
<project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>
57-
<junit.version>4.13.1</junit.version>
57+
<junit.version>5.9.1</junit.version>
5858
<commons.lang.version>2.6</commons.lang.version>
5959
<jacoco.version>0.8.5</jacoco.version>
6060
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
@@ -123,6 +123,11 @@
123123
<target>${java.version}</target>
124124
</configuration>
125125
</plugin>
126+
<plugin>
127+
<groupId>org.apache.maven.plugins</groupId>
128+
<artifactId>maven-surefire-plugin</artifactId>
129+
<version>2.22.2</version>
130+
</plugin>
126131
<!-- Coverage -->
127132
<plugin>
128133
<groupId>org.jacoco</groupId>
@@ -145,7 +150,7 @@
145150
</plugin>
146151
</plugins>
147152
</build>
148-
153+
149154
<reporting>
150155
<plugins>
151156
<plugin>
@@ -211,11 +216,11 @@
211216
</dependency>
212217
<!-- testing -->
213218
<dependency>
214-
<groupId>junit</groupId>
215-
<artifactId>junit</artifactId>
219+
<groupId>org.junit.jupiter</groupId>
220+
<artifactId>junit-jupiter</artifactId>
216221
<version>${junit.version}</version>
217222
<scope>test</scope>
218223
</dependency>
219224
</dependencies>
220225

221-
</project>
226+
</project>

src/test/java/com/tupilabs/human_name_parser/BuilderTest.java

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@
2323
*/
2424
package com.tupilabs.human_name_parser;
2525

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;
2930

3031
import java.util.Arrays;
3132

32-
import org.junit.Test;
33+
import org.junit.jupiter.api.Test;
3334

3435
/**
3536
* Tests for the {@code HumanNameParserBuilder}.
@@ -142,54 +143,54 @@ public void testExtraSalutations() {
142143

143144
// validations
144145

145-
@Test(expected = NullPointerException.class)
146+
@Test
146147
public void testConstructorFailsWithNullString() {
147-
new HumanNameParserBuilder((String) null);
148+
assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder((String) null));
148149
}
149150

150-
@Test(expected = NullPointerException.class)
151+
@Test
151152
public void testConstructorFailsWithNullName() {
152-
new HumanNameParserBuilder((Name) null);
153+
assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder((Name) null));
153154
}
154155

155-
@Test(expected = NullPointerException.class)
156+
@Test
156157
public void testFailsToBuildWithNullSalutations1() {
157-
new HumanNameParserBuilder("john paul").withSalutations(null).build();
158+
assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder("john paul").withSalutations(null).build());
158159
}
159160

160-
@Test(expected = NullPointerException.class)
161+
@Test
161162
public void testFailsToBuildWithNullSalutations2() {
162-
new HumanNameParserBuilder("john paul").withExtraSalutations(null).build();
163+
assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder("john paul").withExtraSalutations(null).build());
163164
}
164165

165-
@Test(expected = NullPointerException.class)
166+
@Test
166167
public void testFailsToBuildWithNullPostnominals1() {
167-
new HumanNameParserBuilder("john paul").withPostnominals(null).build();
168+
assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder("john paul").withPostnominals(null).build());
168169
}
169170

170-
@Test(expected = NullPointerException.class)
171+
@Test
171172
public void testFailsToBuildWithNullPostnominals2() {
172-
new HumanNameParserBuilder("john paul").withExtraPostnominals(null).build();
173+
assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder("john paul").withExtraPostnominals(null).build());
173174
}
174175

175-
@Test(expected = NullPointerException.class)
176+
@Test
176177
public void testFailsToBuildWithNullSuffixes1() {
177-
new HumanNameParserBuilder("john paul").withSuffixes(null).build();
178+
assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder("john paul").withSuffixes(null).build());
178179
}
179180

180-
@Test(expected = NullPointerException.class)
181+
@Test
181182
public void testFailsToBuildWithNullSuffixes2() {
182-
new HumanNameParserBuilder("john paul").withExtraSuffixes(null).build();
183+
assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder("john paul").withExtraSuffixes(null).build());
183184
}
184185

185-
@Test(expected = NullPointerException.class)
186+
@Test
186187
public void testFailsToBuildWithNullPrefixes1() {
187-
new HumanNameParserBuilder("john paul").withPrefixes(null).build();
188+
assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder("john paul").withPrefixes(null).build());
188189
}
189190

190-
@Test(expected = NullPointerException.class)
191+
@Test
191192
public void testFailsToBuildWithNullPrefixes2() {
192-
new HumanNameParserBuilder("john paul").withExtraPrefixes(null).build();
193+
assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder("john paul").withExtraPrefixes(null).build());
193194
}
194195

195196
@Test

src/test/java/com/tupilabs/human_name_parser/NameTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
*/
2424
package com.tupilabs.human_name_parser;
2525

26-
import static org.junit.Assert.assertEquals;
26+
import static org.junit.jupiter.api.Assertions.assertEquals;
2727

28-
import org.junit.Before;
29-
import org.junit.Test;
28+
import org.junit.jupiter.api.BeforeEach;
29+
import org.junit.jupiter.api.Test;
3030

3131
/**
3232
* Tests for {@code Name} and {@code HumanNameParserParser}. Utilizes the same
@@ -38,7 +38,7 @@ public class NameTest {
3838

3939
protected Name object;
4040

41-
@Before
41+
@BeforeEach
4242
public void setUp() {
4343
object = new Name("Bjorn O'Malley");
4444
}

src/test/java/com/tupilabs/human_name_parser/ParserTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*/
2424
package com.tupilabs.human_name_parser;
2525

26-
import static org.junit.Assert.assertEquals;
26+
import static org.junit.jupiter.api.Assertions.assertEquals;
2727

2828
import java.io.BufferedReader;
2929
import java.io.File;
@@ -32,16 +32,16 @@
3232
import java.util.logging.Logger;
3333

3434
import org.apache.commons.lang.StringUtils;
35-
import org.junit.BeforeClass;
36-
import org.junit.Test;
35+
import org.junit.jupiter.api.BeforeAll;
36+
import org.junit.jupiter.api.Test;
3737

3838
public class ParserTest {
3939

4040
private static final Logger LOGGER = Logger.getLogger(ParserTest.class.getName());
4141

4242
private static File testNames = null;
4343

44-
@BeforeClass
44+
@BeforeAll
4545
public static void setUp() {
4646
testNames = new File(ParserTest.class.getResource("/testNames.txt").getFile());
4747
}

0 commit comments

Comments
 (0)