]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10247 add OrganizationDto#equals & hashcode
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Wed, 17 Jan 2018 10:38:41 +0000 (11:38 +0100)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Tue, 23 Jan 2018 08:36:10 +0000 (09:36 +0100)
usefull in unit tests

server/sonar-db-dao/src/main/java/org/sonar/db/organization/OrganizationDto.java

index e0c3c09f0ab145197db2caae6ccf2872b7ddf175..e8548462f3818b0b82c0edfee71d289762eeca87 100644 (file)
@@ -19,6 +19,7 @@
  */
 package org.sonar.db.organization;
 
+import java.util.Objects;
 import javax.annotation.CheckForNull;
 import javax.annotation.Nullable;
 
@@ -157,6 +158,23 @@ public class OrganizationDto {
     return this;
   }
 
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) {
+      return true;
+    }
+    if (o == null || getClass() != o.getClass()) {
+      return false;
+    }
+    OrganizationDto that = (OrganizationDto) o;
+    return Objects.equals(uuid, that.uuid);
+  }
+
+  @Override
+  public int hashCode() {
+    return Objects.hash(uuid);
+  }
+
   @Override
   public String toString() {
     return "OrganizationDto{" +