You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2009/02/10 10:29:50 UTC
svn commit: r742911 -
/maven/components/branches/maven-2.1.x/maven-model/src/test/java/org/apache/maven/model/ReportPluginTest.java
Author: brett
Date: Tue Feb 10 09:29:46 2009
New Revision: 742911
URL: http://svn.apache.org/viewvc?rev=742911&view=rev
Log:
add test case for identity and hashcode behaviour
Modified:
maven/components/branches/maven-2.1.x/maven-model/src/test/java/org/apache/maven/model/ReportPluginTest.java
Modified: maven/components/branches/maven-2.1.x/maven-model/src/test/java/org/apache/maven/model/ReportPluginTest.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x/maven-model/src/test/java/org/apache/maven/model/ReportPluginTest.java?rev=742911&r1=742910&r2=742911&view=diff
==============================================================================
--- maven/components/branches/maven-2.1.x/maven-model/src/test/java/org/apache/maven/model/ReportPluginTest.java (original)
+++ maven/components/branches/maven-2.1.x/maven-model/src/test/java/org/apache/maven/model/ReportPluginTest.java Tue Feb 10 09:29:46 2009
@@ -41,6 +41,42 @@
assertFalse( new ReportPlugin().equals( null ) );
}
+ public void testEqualsIsKey()
+ {
+ ReportPlugin thing = new ReportPlugin();
+ thing.setGroupId( "groupId" );
+ thing.setArtifactId( "artifactId" );
+ thing.setVersion( "1.0" );
+ ReportPlugin thing2 = new ReportPlugin();
+ thing2.setGroupId( "groupId" );
+ thing2.setArtifactId( "artifactId" );
+ thing2.setVersion( "2.0" );
+ assertEquals( thing2, thing );
+
+ ReportPlugin thing3 = new ReportPlugin();
+ thing3.setGroupId( "otherGroupId" );
+ thing3.setArtifactId( "artifactId" );
+ assertFalse( thing3.equals( thing ) );
+ }
+
+ public void testHashcodeIsId()
+ {
+ ReportPlugin thing = new ReportPlugin();
+ thing.setGroupId( "groupId" );
+ thing.setArtifactId( "artifactId" );
+ thing.setVersion( "1.0" );
+ ReportPlugin thing2 = new ReportPlugin();
+ thing2.setGroupId( "groupId" );
+ thing2.setArtifactId( "artifactId" );
+ thing2.setVersion( "2.0" );
+ assertEquals( thing2.hashCode(), thing.hashCode() );
+
+ ReportPlugin thing3 = new ReportPlugin();
+ thing3.setGroupId( "otherGroupId" );
+ thing3.setArtifactId( "artifactId" );
+ assertFalse( thing3.hashCode() == thing.hashCode() );
+ }
+
public void testEqualsIdentity()
{
ReportPlugin thing = new ReportPlugin();