Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

<properties>
<project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>
<junit.version>4.13.1</junit.version>
<junit.version>5.9.1</junit.version>
<commons.lang.version>2.6</commons.lang.version>
<jacoco.version>0.8.5</jacoco.version>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
Expand Down Expand Up @@ -123,6 +123,11 @@
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
<!-- Coverage -->
<plugin>
<groupId>org.jacoco</groupId>
Expand All @@ -145,7 +150,7 @@
</plugin>
</plugins>
</build>

<reporting>
<plugins>
<plugin>
Expand Down Expand Up @@ -211,11 +216,11 @@
</dependency>
<!-- testing -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

</project>
</project>
49 changes: 25 additions & 24 deletions src/test/java/com/tupilabs/human_name_parser/BuilderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@
*/
package com.tupilabs.human_name_parser;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.Arrays;

import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Tests for the {@code HumanNameParserBuilder}.
Expand Down Expand Up @@ -142,54 +143,54 @@ public void testExtraSalutations() {

// validations

@Test(expected = NullPointerException.class)
@Test
public void testConstructorFailsWithNullString() {
new HumanNameParserBuilder((String) null);
assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder((String) null));
}

@Test(expected = NullPointerException.class)
@Test
public void testConstructorFailsWithNullName() {
new HumanNameParserBuilder((Name) null);
assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder((Name) null));
}

@Test(expected = NullPointerException.class)
@Test
public void testFailsToBuildWithNullSalutations1() {
new HumanNameParserBuilder("john paul").withSalutations(null).build();
assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder("john paul").withSalutations(null).build());
}

@Test(expected = NullPointerException.class)
@Test
public void testFailsToBuildWithNullSalutations2() {
new HumanNameParserBuilder("john paul").withExtraSalutations(null).build();
assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder("john paul").withExtraSalutations(null).build());
}

@Test(expected = NullPointerException.class)
@Test
public void testFailsToBuildWithNullPostnominals1() {
new HumanNameParserBuilder("john paul").withPostnominals(null).build();
assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder("john paul").withPostnominals(null).build());
}

@Test(expected = NullPointerException.class)
@Test
public void testFailsToBuildWithNullPostnominals2() {
new HumanNameParserBuilder("john paul").withExtraPostnominals(null).build();
assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder("john paul").withExtraPostnominals(null).build());
}

@Test(expected = NullPointerException.class)
@Test
public void testFailsToBuildWithNullSuffixes1() {
new HumanNameParserBuilder("john paul").withSuffixes(null).build();
assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder("john paul").withSuffixes(null).build());
}

@Test(expected = NullPointerException.class)
@Test
public void testFailsToBuildWithNullSuffixes2() {
new HumanNameParserBuilder("john paul").withExtraSuffixes(null).build();
assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder("john paul").withExtraSuffixes(null).build());
}

@Test(expected = NullPointerException.class)
@Test
public void testFailsToBuildWithNullPrefixes1() {
new HumanNameParserBuilder("john paul").withPrefixes(null).build();
assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder("john paul").withPrefixes(null).build());
}

@Test(expected = NullPointerException.class)
@Test
public void testFailsToBuildWithNullPrefixes2() {
new HumanNameParserBuilder("john paul").withExtraPrefixes(null).build();
assertThrows(NullPointerException.class, () -> new HumanNameParserBuilder("john paul").withExtraPrefixes(null).build());
}

@Test
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/com/tupilabs/human_name_parser/NameTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
*/
package com.tupilabs.human_name_parser;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

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

protected Name object;

@Before
@BeforeEach
public void setUp() {
object = new Name("Bjorn O'Malley");
}
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/com/tupilabs/human_name_parser/ParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
package com.tupilabs.human_name_parser;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.BufferedReader;
import java.io.File;
Expand All @@ -32,16 +32,16 @@
import java.util.logging.Logger;

import org.apache.commons.lang.StringUtils;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

public class ParserTest {

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

private static File testNames = null;

@BeforeClass
@BeforeAll
public static void setUp() {
testNames = new File(ParserTest.class.getResource("/testNames.txt").getFile());
}
Expand Down