commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject [3/5] [text] Use hamcrest matchers for checking results
Date Sun, 19 Apr 2015 09:48:39 GMT
Use hamcrest matchers for checking results


Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/734b777c
Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/734b777c
Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/734b777c

Branch: refs/heads/master
Commit: 734b777c09b6a637dbfa2eb341eeaa573dbe39bb
Parents: b6dbc7a
Author: Benedikt Ritter <britter@apache.org>
Authored: Sun Apr 19 11:43:13 2015 +0200
Committer: Benedikt Ritter <britter@apache.org>
Committed: Sun Apr 19 11:43:13 2015 +0200

----------------------------------------------------------------------
 .../commons/text/names/HumanNameParserTest.java | 27 ++++++++++----------
 1 file changed, 14 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-text/blob/734b777c/src/test/java/org/apache/commons/text/names/HumanNameParserTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/names/HumanNameParserTest.java b/src/test/java/org/apache/commons/text/names/HumanNameParserTest.java
index 59f98a1..86cd304 100644
--- a/src/test/java/org/apache/commons/text/names/HumanNameParserTest.java
+++ b/src/test/java/org/apache/commons/text/names/HumanNameParserTest.java
@@ -16,7 +16,8 @@
  */
 package org.apache.commons.text.names;
 
-import static org.junit.Assert.assertEquals;
+import static org.hamcrest.Matchers.equalTo;
+import static org.junit.Assert.assertThat;
 
 import java.nio.charset.Charset;
 
@@ -65,23 +66,23 @@ public class HumanNameParserTest {
     private void validateRecord(CSVRecord record) {
         HumanNameParser parser = new HumanNameParser(record.get(Colums.Name));
 
-        assertEquals("Wrong LeadingInit in record " + record.getRecordNumber(),
-                record.get(Colums.LeadingInit), parser.getLeadingInit());
+        assertThat("Wrong LeadingInit in record " + record.getRecordNumber(),
+                parser.getLeadingInit(), equalTo(record.get(Colums.LeadingInit)));
         
-        assertEquals("Wrong FirstName in record " + record.getRecordNumber(), 
-                record.get(Colums.FirstName), parser.getFirst());
+        assertThat("Wrong FirstName in record " + record.getRecordNumber(),
+                parser.getFirst(), equalTo(record.get(Colums.FirstName)));
         
-        assertEquals("Wrong NickName in record " + record.getRecordNumber(), 
-                record.get(Colums.NickName), parser.getNickname());
+        assertThat("Wrong NickName in record " + record.getRecordNumber(),
+                parser.getNickname(), equalTo(record.get(Colums.NickName)));
         
-        assertEquals("Wrong MiddleName in record " + record.getRecordNumber(), 
-                record.get(Colums.MiddleName), parser.getMiddle());
+        assertThat("Wrong MiddleName in record " + record.getRecordNumber(),
+                parser.getMiddle(), equalTo(record.get(Colums.MiddleName)));
         
-        assertEquals("Wrong LastName in record " + record.getRecordNumber(), 
-                record.get(Colums.LastName), parser.getLast());
+        assertThat("Wrong LastName in record " + record.getRecordNumber(),
+                parser.getLast(), equalTo(record.get(Colums.LastName)));
         
-        assertEquals("Wrong Suffix in record " + record.getRecordNumber(), 
-                record.get(Colums.Suffix), parser.getSuffix());
+        assertThat("Wrong Suffix in record " + record.getRecordNumber(),
+                parser.getSuffix(), equalTo(record.get(Colums.Suffix)));
     }
 
     private enum Colums {


Mime
View raw message