ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seanfi...@apache.org
Subject svn commit: r1823057 - in /ctakes/trunk/ctakes-core/src: main/java/org/apache/ctakes/core/util/NumberedSuffixComparator.java test/java/org/apache/ctakes/core/util/NumberedSuffixComparatorTester.java
Date Sat, 03 Feb 2018 18:50:56 GMT
Author: seanfinan
Date: Sat Feb  3 18:50:56 2018
New Revision: 1823057

URL: http://svn.apache.org/viewvc?rev=1823057&view=rev
Log:
Migrated test for comparator

Added:
    ctakes/trunk/ctakes-core/src/test/java/org/apache/ctakes/core/util/NumberedSuffixComparatorTester.java
Modified:
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/NumberedSuffixComparator.java

Modified: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/NumberedSuffixComparator.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/NumberedSuffixComparator.java?rev=1823057&r1=1823056&r2=1823057&view=diff
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/NumberedSuffixComparator.java
(original)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/NumberedSuffixComparator.java
Sat Feb  3 18:50:56 2018
@@ -14,7 +14,7 @@ import java.util.Comparator;
  * @since 8/25/2017
  */
 public class NumberedSuffixComparator implements Comparator<String> {
-   static private final Logger LOGGER = Logger.getLogger( "TextNumberComparator" );
+   static private final Logger LOGGER = Logger.getLogger( "NumberedSuffixComparator" );
 
    /**
     * {@inheritDoc}

Added: ctakes/trunk/ctakes-core/src/test/java/org/apache/ctakes/core/util/NumberedSuffixComparatorTester.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/test/java/org/apache/ctakes/core/util/NumberedSuffixComparatorTester.java?rev=1823057&view=auto
==============================================================================
--- ctakes/trunk/ctakes-core/src/test/java/org/apache/ctakes/core/util/NumberedSuffixComparatorTester.java
(added)
+++ ctakes/trunk/ctakes-core/src/test/java/org/apache/ctakes/core/util/NumberedSuffixComparatorTester.java
Sat Feb  3 18:50:56 2018
@@ -0,0 +1,66 @@
+package org.apache.ctakes.core.util;
+
+import org.junit.Test;
+
+import java.util.Comparator;
+
+import static org.junit.Assert.assertTrue;
+
+/**
+ * @author SPF , chip-nlp
+ * @version %I%
+ * @since 8/25/2017
+ */
+public class NumberedSuffixComparatorTester {
+
+   // Standard 1
+   static private final String ABC_1 = "abc_1";
+
+   // 1 Greater Than
+   static private final String ABC_0 = "abc_0";
+   static private final String ABC_00 = "abc_00";
+
+   // 1 Less Than
+   static private final String ABC_01 = "abc_01";
+   static private final String ABC_2 = "abc_2";
+   static private final String ABC_10 = "abc_10";
+   static private final String ABC_1A = "abc_1_a";
+   static private final String ABC_01A = "abc_01_a";
+   static private final String BBC_1 = "bbc_1";
+   static private final String ACC_1 = "acc_1";
+   static private final String ABD_1 = "abd_1";
+
+   // Standard 2
+   static private final String _1_ABC = "1_abc";
+
+   // 2 Less Than
+   static private final String _01_ABC = "01_abc";
+   static private final String _2_ABC = "2_abc";
+   static private final String _10_ABC = "10_abc";
+   static private final String _1A_ABC = "1a_abc";
+   static private final String _1_BBC = "1_bbc";
+
+
+   @Test
+   public void testCompare() {
+      final Comparator<String> comparator = new NumberedSuffixComparator();
+      assertTrue( comparator.compare( ABC_1, ABC_1 ) == 0 );
+
+      assertTrue( comparator.compare( ABC_1, ABC_01 ) < 0 );
+      assertTrue( comparator.compare( ABC_1, ABC_2 ) < 0 );
+      assertTrue( comparator.compare( ABC_1, ABC_10 ) < 0 );
+      assertTrue( comparator.compare( ABC_1, ABC_1A ) < 0 );
+      assertTrue( comparator.compare( ABC_1, ABC_01A ) < 0 );
+      assertTrue( comparator.compare( ABC_1, BBC_1 ) < 0 );
+      assertTrue( comparator.compare( ABC_1, ACC_1 ) < 0 );
+      assertTrue( comparator.compare( ABC_1, ABD_1 ) < 0 );
+
+      assertTrue( comparator.compare( _1_ABC, _1_ABC ) == 0 );
+      assertTrue( comparator.compare( _1_ABC, _01_ABC ) < 0 );
+      assertTrue( comparator.compare( _1_ABC, _2_ABC ) < 0 );
+      assertTrue( comparator.compare( _1_ABC, _10_ABC ) < 0 );
+      assertTrue( comparator.compare( _1_ABC, _1A_ABC ) < 0 );
+      assertTrue( comparator.compare( _1_ABC, _1_BBC ) < 0 );
+   }
+
+}



Mime
View raw message