]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6799 ReportComponent in tests should always have a key and uuid
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Thu, 24 Sep 2015 16:30:10 +0000 (18:30 +0200)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Mon, 28 Sep 2015 07:19:02 +0000 (09:19 +0200)
server/sonar-server/src/test/java/org/sonar/server/computation/component/ReportComponent.java

index 4f16dbf4c6fb96aabe7785392aaa2bce03145ae7..9b49a675a30cf87a2345135dbf20f86cf20701f6 100644 (file)
@@ -22,6 +22,7 @@ package org.sonar.server.computation.component;
 import com.google.common.collect.ImmutableList;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
 import javax.annotation.CheckForNull;
 import javax.annotation.Nullable;
 
@@ -142,7 +143,7 @@ public class ReportComponent implements Component {
   }
 
   public static Builder builder(Type type, int ref) {
-    return new Builder(type, ref);
+    return new Builder(type, ref).setKey("key_" + ref).setUuid("uuid_" + ref);
   }
 
   public static final class Builder {
@@ -163,8 +164,8 @@ public class ReportComponent implements Component {
       this.ref = ref;
     }
 
-    public Builder setUuid(@Nullable String s) {
-      this.uuid = s;
+    public Builder setUuid(String s) {
+      this.uuid = Objects.requireNonNull(s);
       return this;
     }
 
@@ -173,8 +174,8 @@ public class ReportComponent implements Component {
       return this;
     }
 
-    public Builder setKey(@Nullable String s) {
-      this.key = s;
+    public Builder setKey(String s) {
+      this.key = Objects.requireNonNull(s);
       return this;
     }