incubator-depot-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nickcha...@apache.org
Subject svn commit: rev 35652 - incubator/depot/trunk/version/src/test/java/org/apache/depot/version/impl
Date Tue, 03 Aug 2004 23:30:33 GMT
Author: nickchalko
Date: Tue Aug  3 16:30:33 2004
New Revision: 35652

Added:
   incubator/depot/trunk/version/src/test/java/org/apache/depot/version/impl/ApacheVersionTest.java
Log:
Added ApacheVersionTest.

Added: incubator/depot/trunk/version/src/test/java/org/apache/depot/version/impl/ApacheVersionTest.java
==============================================================================
--- (empty file)
+++ incubator/depot/trunk/version/src/test/java/org/apache/depot/version/impl/ApacheVersionTest.java
Tue Aug  3 16:30:33 2004
@@ -0,0 +1,70 @@
+/*
+ * $Id: $
+ */
+package org.apache.depot.version.impl;
+
+import org.apache.depot.version.CompoundVersion;
+import org.apache.depot.version.VersionException;
+import org.apache.depot.version.impl.data.ReleaseLevel;
+import org.apache.depot.version.impl.data.VersionData;
+
+import junit.framework.TestCase;
+
+/**
+ * @author <a href="http://nick.chalko.com">Nick Chalko </a>
+ * @author $Author: $
+ * @version $Revision: $
+ */
+public class ApacheVersionTest extends TestCase {
+
+    /*
+     * Class under test for void ApacheVersion(String)
+     */
+    public void testApacheVersionString() throws VersionException {
+        assertApacheVersion("1.2.1", 1, 2, 1, ReleaseLevel.DEFAULT);
+        assertApacheVersion("1.2.1-dev", 1, 2, 1, ReleaseLevel.DEVELOPMENT);
+
+    }
+
+    /**
+     * @param versionString
+     * @param expectedMajor
+     * @param expectedMinor
+     * @param expectedPoint
+     * @param expectedReleaseLevel
+     * @throws VersionException
+     */
+    private void assertApacheVersion(final String versionString, int expectedMajor, int expectedMinor,
+            int expectedPoint, ReleaseLevel expectedReleaseLevel) throws VersionException
{
+        ApacheVersion av = new ApacheVersion(versionString);
+        assertVersion(versionString, av, expectedMajor, expectedMinor, expectedPoint, expectedReleaseLevel);
+    }
+
+    /**
+     * @param versionString
+     * @param av
+     * @param expectedMajor
+     * @param expectedMinor
+     * @param expectedPoint
+     * @param expectedReleaseLevel
+     */
+    private void assertVersion(final String versionString, ApacheVersion av, int expectedMajor,
int expectedMinor,
+            int expectedPoint, ReleaseLevel expectedReleaseLevel) {
+        assertCompondVersion(versionString, av, expectedMajor, expectedMinor, expectedPoint);
+        assertEquals(versionString + ".releaseLevel", expectedReleaseLevel, av.getReleaseLevelObject());
+    }
+
+    /**
+     * @param versionString
+     * @param av
+     * @param expectedMajor
+     * @param expectedMinor
+     * @param expectedPoint
+     */
+    private void assertCompondVersion(final String versionString, CompoundVersion av, int
expectedMajor, int expectedMinor, int expectedPoint) {
+        assertEquals(versionString + ".major", expectedMajor, av.getMajor());
+        assertEquals(versionString + ".minor", expectedMinor, av.getMinor());
+        assertEquals(versionString + ".point", expectedPoint, av.getMajor());
+    }
+
+}
\ No newline at end of file

Mime
View raw message