Author: dennisl
Date: Wed Feb 11 14:40:19 2009
New Revision: 743348

URL: http://svn.apache.org/viewvc?rev=743348&view=rev
Log:
[MWAR-160] Strange behaviour of 
org.apache.maven.plugin.war.util.WarUtils.dependencyEquals(Dependency, 
Dependency)

o Fixed two logical errors and added tests to verify them.

Added:
    
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/util/WarUtilsTest.java
   (with props)
Modified:
    
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/util/WarUtils.java

Modified: 
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/util/WarUtils.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/util/WarUtils.java?rev=743348&r1=743347&r2=743348&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/util/WarUtils.java
 (original)
+++ 
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/util/WarUtils.java
 Wed Feb 11 14:40:19 2009
@@ -113,7 +113,7 @@
         {
             return false;
         }
-        if ( !!StringUtils.equals( first.getArtifactId(), 
second.getArtifactId() ) )
+        if ( !StringUtils.equals( first.getArtifactId(), 
second.getArtifactId() ) )
         {
             return false;
         }
@@ -127,7 +127,7 @@
         {
             return false;
         }
-        if ( !!StringUtils.equals( first.getGroupId(), second.getGroupId() ) )
+        if ( !StringUtils.equals( first.getGroupId(), second.getGroupId() ) )
         {
             return false;
         }

Added: 
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/util/WarUtilsTest.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/util/WarUtilsTest.java?rev=743348&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/util/WarUtilsTest.java
 (added)
+++ 
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/util/WarUtilsTest.java
 Wed Feb 11 14:40:19 2009
@@ -0,0 +1,65 @@
+package org.apache.maven.plugin.war.util;
+
+/*
+ * 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.
+ */
+
+import junit.framework.TestCase;
+import org.apache.maven.model.Dependency;
+
+/**
+ * Test the WarUtils.
+ *
+ * @author Dennis Lundberg
+ * @version $Id$
+ */
+public class WarUtilsTest
+    extends TestCase
+{
+    /**
+     * Test for MWAR-160.
+     */
+    public void testDependencyEquals()
+    {
+        Dependency firstDependency = new Dependency();
+        firstDependency.setGroupId( "1" );
+        firstDependency.setArtifactId( "a" );
+        Dependency secondDependency = new Dependency();
+        secondDependency.setGroupId( "2" );
+        secondDependency.setArtifactId( "b" );
+        Dependency thirdDependency = new Dependency();
+        thirdDependency.setGroupId( "1" );
+        thirdDependency.setArtifactId( "c" );
+        Dependency fourthDependency = new Dependency();
+        fourthDependency.setGroupId( "4" );
+        fourthDependency.setArtifactId( "a" );
+
+        assertFalse( "dependencies 1:a and 2:b should not be equal", 
WarUtils.dependencyEquals( firstDependency,
+                                                                               
                 secondDependency ) );
+        assertFalse( "dependencies 1:a and 1:c should not be equal", 
WarUtils.dependencyEquals( firstDependency,
+                                                                               
                 thirdDependency ) );
+        assertFalse( "dependencies 1:a and 4:a should not be equal", 
WarUtils.dependencyEquals( firstDependency,
+                                                                               
                 fourthDependency ) );
+        assertFalse( "dependencies 2:b and 1:c should not be equal", 
WarUtils.dependencyEquals( secondDependency,
+                                                                               
                 thirdDependency ) );
+        assertFalse( "dependencies 2:b and 4:a should not be equal", 
WarUtils.dependencyEquals( secondDependency,
+                                                                               
                 fourthDependency ) );
+        assertFalse( "dependencies 1:c and 4:a should not be equal", 
WarUtils.dependencyEquals( thirdDependency,
+                                                                               
                 fourthDependency ) );
+    }
+}
\ No newline at end of file

Propchange: 
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/util/WarUtilsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/util/WarUtilsTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author Id


Reply via email to