Add test for null version string
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@926022 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/utils/src/test/java/org/apache/felix/utils/version/VersionCleanerTest.java b/utils/src/test/java/org/apache/felix/utils/version/VersionCleanerTest.java
index 594b46d..dd80aff 100644
--- a/utils/src/test/java/org/apache/felix/utils/version/VersionCleanerTest.java
+++ b/utils/src/test/java/org/apache/felix/utils/version/VersionCleanerTest.java
@@ -26,47 +26,50 @@
{
String osgiVersion;
- osgiVersion = VersionCleaner.clean( "" );
- assertEquals( "0.0.0", osgiVersion );
+ osgiVersion = VersionCleaner.clean(null);
+ assertEquals("0.0.0", osgiVersion);
- osgiVersion = VersionCleaner.clean( "2.1.0-SNAPSHOT" );
- assertEquals( "2.1.0.SNAPSHOT", osgiVersion );
+ osgiVersion = VersionCleaner.clean("");
+ assertEquals("0.0.0", osgiVersion);
- osgiVersion = VersionCleaner.clean( "2.1-SNAPSHOT" );
- assertEquals( "2.1.0.SNAPSHOT", osgiVersion );
+ osgiVersion = VersionCleaner.clean("2.1.0-SNAPSHOT");
+ assertEquals("2.1.0.SNAPSHOT", osgiVersion);
- osgiVersion = VersionCleaner.clean( "2-SNAPSHOT" );
- assertEquals( "2.0.0.SNAPSHOT", osgiVersion );
+ osgiVersion = VersionCleaner.clean("2.1-SNAPSHOT");
+ assertEquals("2.1.0.SNAPSHOT", osgiVersion);
- osgiVersion = VersionCleaner.clean( "2" );
- assertEquals( "2.0.0", osgiVersion );
+ osgiVersion = VersionCleaner.clean("2-SNAPSHOT");
+ assertEquals("2.0.0.SNAPSHOT", osgiVersion);
- osgiVersion = VersionCleaner.clean( "2.1" );
- assertEquals( "2.1.0", osgiVersion );
+ osgiVersion = VersionCleaner.clean("2");
+ assertEquals("2.0.0", osgiVersion);
- osgiVersion = VersionCleaner.clean( "2.1.3" );
- assertEquals( "2.1.3", osgiVersion );
+ osgiVersion = VersionCleaner.clean("2.1");
+ assertEquals("2.1.0", osgiVersion);
- osgiVersion = VersionCleaner.clean( "2.1.3.4" );
- assertEquals( "2.1.3.4", osgiVersion );
+ osgiVersion = VersionCleaner.clean("2.1.3");
+ assertEquals("2.1.3", osgiVersion);
- osgiVersion = VersionCleaner.clean( "4aug2000r7-dev" );
- assertEquals( "0.0.0.4aug2000r7-dev", osgiVersion );
+ osgiVersion = VersionCleaner.clean("2.1.3.4");
+ assertEquals("2.1.3.4", osgiVersion);
- osgiVersion = VersionCleaner.clean( "1.1-alpha-2" );
- assertEquals( "1.1.0.alpha-2", osgiVersion );
+ osgiVersion = VersionCleaner.clean("4aug2000r7-dev");
+ assertEquals("0.0.0.4aug2000r7-dev", osgiVersion);
- osgiVersion = VersionCleaner.clean( "1.0-alpha-16-20070122.203121-13" );
- assertEquals( "1.0.0.alpha-16-20070122_203121-13", osgiVersion );
+ osgiVersion = VersionCleaner.clean("1.1-alpha-2");
+ assertEquals("1.1.0.alpha-2", osgiVersion);
- osgiVersion = VersionCleaner.clean( "1.0-20070119.021432-1" );
- assertEquals( "1.0.0.20070119_021432-1", osgiVersion );
+ osgiVersion = VersionCleaner.clean("1.0-alpha-16-20070122.203121-13");
+ assertEquals("1.0.0.alpha-16-20070122_203121-13", osgiVersion);
- osgiVersion = VersionCleaner.clean( "1-20070119.021432-1" );
- assertEquals( "1.0.0.20070119_021432-1", osgiVersion );
+ osgiVersion = VersionCleaner.clean("1.0-20070119.021432-1");
+ assertEquals("1.0.0.20070119_021432-1", osgiVersion);
- osgiVersion = VersionCleaner.clean( "1.4.1-20070217.082013-7" );
- assertEquals( "1.4.1.20070217_082013-7", osgiVersion );
+ osgiVersion = VersionCleaner.clean("1-20070119.021432-1");
+ assertEquals("1.0.0.20070119_021432-1", osgiVersion);
+
+ osgiVersion = VersionCleaner.clean("1.4.1-20070217.082013-7");
+ assertEquals("1.4.1.20070217_082013-7", osgiVersion);
}
}