]> source.dussan.org Git - archiva.git/commitdiff
Expanding unit tests. (needed to eliminate this as possible cause for other issue)
authorJoakim Erdfelt <joakime@apache.org>
Wed, 26 Sep 2007 17:23:43 +0000 (17:23 +0000)
committerJoakim Erdfelt <joakime@apache.org>
Wed, 26 Sep 2007 17:23:43 +0000 (17:23 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@579721 13f79535-47bb-0310-9956-ffa450edef68

archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/VersionComparatorTest.java

index 666f705397397331c8bffc3d87b0020a969ccfcf..4bfef29fb3bb85bcffd0022df312f3d755599337 100644 (file)
@@ -38,7 +38,7 @@ public class VersionComparatorTest
     public void testComparator()
     {
         /* Sort order is oldest to newest */
-        
+
         assertSort( new String[] { "1.0", "3.0", "2.0" }, new String[] { "1.0", "2.0", "3.0" } );
         assertSort( new String[] { "1.5", "1.2", "1.0" }, new String[] { "1.0", "1.2", "1.5" } );
 
@@ -49,6 +49,7 @@ public class VersionComparatorTest
             "1.1-rc1",
             "1.1-m6",
             "1.1" } );
+
         assertSort( new String[] { "1.1-m6", "1.0-SNAPSHOT", "1.1-rc1", "1.1" }, new String[] {
             "1.0-SNAPSHOT",
             "1.1-rc1",
@@ -61,12 +62,43 @@ public class VersionComparatorTest
             "2.0.4-SNAPSHOT",
             "2.0.5" } );
 
+        assertSort( new String[] { "1.0-alpha-1", "1.0-alpha-22", "1.0-alpha-10", "1.0-alpha-9" }, new String[] {
+            "1.0-alpha-1",
+            "1.0-alpha-9",
+            "1.0-alpha-10",
+            "1.0-alpha-22" } );
+
+        assertSort( new String[] { "1.0-alpha1", "1.0-alpha22", "1.0-alpha10", "1.0-alpha9" }, new String[] {
+            "1.0-alpha1",
+            "1.0-alpha9",
+            "1.0-alpha10",
+            "1.0-alpha22" } );
+        
+        assertSort( new String[] { "1.0-1", "1.0-22", "1.0-10", "1.0-9" }, new String[] {
+            "1.0-1",
+            "1.0-9",
+            "1.0-10",
+            "1.0-22" } );
+        
+        assertSort( new String[] { "alpha-1", "alpha-22", "alpha-10", "alpha-9" }, new String[] {
+            "alpha-1",
+            "alpha-9",
+            "alpha-10",
+            "alpha-22" } );
+        
+        assertSort( new String[] { "1.0.1", "1.0.22", "1.0.10", "1.0.9" }, new String[] {
+            "1.0.1",
+            "1.0.9",
+            "1.0.10",
+            "1.0.22" } );
+        
+        
         // TODO: write more unit tests.
     }
 
     private void assertSort( String[] rawVersions, String[] expectedSort )
     {
-        List versions = new ArrayList();
+        List<String> versions = new ArrayList<String>();
         versions.addAll( Arrays.asList( rawVersions ) );
 
         Collections.sort( versions, VersionComparator.getInstance() );