Skip to content

Commit af61b17

Browse files
committed
Added name parser functional test.
1 parent 5e98e2b commit af61b17

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/test/functional/java/org/nameapi/client/services/parser/personnameparser/PersonNameParserCommandTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,18 @@ public void genderDispute() throws Exception {
130130
assertEquals(bestMatch.getParserDisputes().get(0).getDisputeType(), DisputeType.GENDER);
131131
}
132132

133+
134+
135+
@Test
136+
public void testParseSingleGivenName() throws Exception {
137+
NaturalInputPerson inputPerson = new NaturalInputPersonBuilder().name(new WesternInputPersonNameBuilder().fullname("John").build()).build();
138+
PersonNameParserCommand command = new PersonNameParserCommand();
139+
Mode mode = FunctionalTestsNameApiModeFactory.functionalTest();
140+
PersonNameParserResult result = executor.execute(command, mode, inputPerson).get();
141+
ParsedPerson parsedPerson = result.getBestMatch().getParsedPerson();
142+
OutputPersonName firstName = parsedPerson.getOutputPersonName();
143+
assertEquals("John", firstName.getFirst(TermType.GIVENNAME).get().getString());
144+
assertEquals(parsedPerson.getGender().getGender(), ComputedPersonGender.MALE);
145+
}
146+
133147
}

0 commit comments

Comments
 (0)