You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-commits@incubator.apache.org by xa...@apache.org on 2007/06/28 13:18:56 UTC
svn commit: r551549 - in /incubator/ivy/core/trunk: CHANGES.txt
test/java/org/apache/ivy/core/module/id/ModuleIdTest.java
Author: xavier
Date: Thu Jun 28 06:18:55 2007
New Revision: 551549
URL: http://svn.apache.org/viewvc?view=rev&rev=551549
Log:
IMPROVEMENT: Unit test improvements (IVY-545) (thanks to Tjeerd Verhagen)
Added:
incubator/ivy/core/trunk/test/java/org/apache/ivy/core/module/id/ModuleIdTest.java (with props)
Modified:
incubator/ivy/core/trunk/CHANGES.txt
Modified: incubator/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/CHANGES.txt?view=diff&rev=551549&r1=551548&r2=551549
==============================================================================
--- incubator/ivy/core/trunk/CHANGES.txt (original)
+++ incubator/ivy/core/trunk/CHANGES.txt Thu Jun 28 06:18:55 2007
@@ -60,7 +60,8 @@
- IMPROVEMENT: Remove @author tags (thanks to Stephane Bailliez)
- IMPROVEMENT: Remove use of deprecated elements in ivysettings.xml (IVY-505) (with contribution from Jan Materne)
- IMPROVEMENT: Buildlist onlydirectdep attribute (IVY-473 and IVY-504) (with contribution from Mikkel Bjerg )
-- IMPROVEMENT: Javadoc improvements (IVY-544) (thanks to Tjeerd Verhagen)
+- IMPROVEMENT: Javadoc improvements (IVY-544) (with contribution from Tjeerd Verhagen)
+- IMPROVEMENT: Unit test improvements (IVY-545) (thanks to Tjeerd Verhagen)
- FIX: Evicted modules report depends on the order of the dependencies (IVY-526)
- FIX: Ivy does not work on Turkish machines (IVY-65)
Added: incubator/ivy/core/trunk/test/java/org/apache/ivy/core/module/id/ModuleIdTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/core/module/id/ModuleIdTest.java?view=auto&rev=551549
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/core/module/id/ModuleIdTest.java (added)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/core/module/id/ModuleIdTest.java Thu Jun 28 06:18:55 2007
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.core.module.id;
+
+import junit.framework.TestCase;
+
+public class ModuleIdTest extends TestCase {
+
+ public void testModuleId() {
+ String org = "apache";
+ String name = "some-new-module";
+ ModuleId moduleId = new ModuleId(org, name);
+
+ assertEquals(org, moduleId.getOrganisation());
+ assertEquals(name, moduleId.getName());
+ }
+
+ public void testModuleIdIllegalArgumentException() {
+ String org = "apache";
+ String name = "some-new-module";
+
+ try {
+ new ModuleId(null, name);
+ } catch (IllegalArgumentException iae) {
+ fail("A null should be allowed for argument 'org'.");
+ }
+
+ try {
+ new ModuleId(org, null);
+ fail("A IllegalArgumentException should have been thrown for the argument 'name'.");
+ } catch (IllegalArgumentException iae) {
+ // success
+ }
+ }
+
+ public void testEqualsObjectTrue() {
+ String org = "apache";
+ String name = "some-new-module";
+ ModuleId moduleId = new ModuleId(org, name);
+ ModuleId moduleId2 = new ModuleId(org, name);
+
+ assertTrue(moduleId.equals(moduleId));
+ assertTrue(moduleId.equals(moduleId2));
+ assertTrue(moduleId2.equals(moduleId));
+ }
+
+ public void testEqualsObjectFalse() {
+ String org = "apache";
+ String name = "some-new-module";
+ ModuleId moduleId = new ModuleId(org, name);
+ ModuleId moduleId2 = new ModuleId(null, name);
+
+ assertFalse(moduleId.equals(null));
+ assertFalse(moduleId.equals(moduleId2));
+ assertFalse(moduleId2.equals(moduleId));
+ }
+
+ public void testEncodeToString() {
+ String org = "apache";
+ String name = "some-new-module";
+ ModuleId moduleId = new ModuleId(org, name);
+
+ assertEquals(org + ModuleId.ENCODE_SEPARATOR + name, moduleId.encodeToString());
+ }
+
+ public void testDecode() {
+ String org = "apache";
+ String name = "some-new-module";
+ ModuleId moduleId = new ModuleId(org, name);
+
+ ModuleId moduleId2 = ModuleId.decode(moduleId.encodeToString());
+ assertEquals(moduleId, moduleId2);
+ }
+
+
+ public void testCompareToNullObject() {
+ String org = "apache";
+ String name = "some-new-module";
+ ModuleId moduleId = new ModuleId(org, name);
+
+ try {
+ moduleId.compareTo(null);
+ fail("A NullPointerException was expected.");
+ } catch (NullPointerException npe) {
+ // success
+ }
+ }
+
+ public void testCompareToOtherObject() {
+ String org = "apache";
+ String name = "some-new-module";
+ ModuleId moduleId = new ModuleId(org, name);
+
+ try {
+ moduleId.compareTo(new String());
+ fail("A ClassCastException was expected.");
+ } catch (ClassCastException cce) {
+ // success
+ }
+ }
+
+ public void testCompareToEqual() {
+ String org = "apache";
+ String name = "some-new-module";
+ ModuleId moduleId = new ModuleId(org, name);
+
+ assertTrue(moduleId.compareTo(new ModuleId(org, name)) == 0);
+ }
+
+ public void testCompareToLessThan() {
+ String org = "apache";
+ String name = "some-new-module";
+ ModuleId moduleId = new ModuleId(org, name);
+ String name2 = "the-new-module";
+ ModuleId moduleId2 = new ModuleId(org, name2);
+ System.out.println(moduleId + "\n" + moduleId2);
+
+ assertTrue(moduleId.compareTo(moduleId2) < 0);
+ }
+
+ public void testCompareToGreatherThan() {
+ String org = "apache";
+ String name = "some-new-module";
+ ModuleId moduleId = new ModuleId(org, name);
+ String name2 = "the-new-module";
+ ModuleId moduleId2 = new ModuleId(org, name2);
+ System.out.println(moduleId + "\n" + moduleId2);
+
+ assertTrue(moduleId2.compareTo(moduleId) > 0);
+ }
+}
Propchange: incubator/ivy/core/trunk/test/java/org/apache/ivy/core/module/id/ModuleIdTest.java
------------------------------------------------------------------------------
svn:eol-style = native