]> source.dussan.org Git - sonarqube.git/commitdiff
Always return a positive number of line when creating a random issue
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 24 Apr 2017 09:02:29 +0000 (11:02 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 25 Apr 2017 08:51:31 +0000 (10:51 +0200)
server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueTesting.java

index a7dba82a2109807e73f590a2e2f7f4bfac9784fd..98ca360e510ddbb035f05033813607aa9bbd9f62 100644 (file)
@@ -54,7 +54,8 @@ public class IssueTesting {
       .setEffort((long) RandomUtils.nextInt(10))
       .setAssignee("assignee_" + randomAlphabetic(5))
       .setAuthorLogin("author_" + randomAlphabetic(5))
-      .setLine(nextInt(1_000))
+      // Adding one to the generated random value in order to never get 0 (as it's a forbidden value)
+      .setLine(nextInt(1_000) + 1)
       .setMessage("message_" + randomAlphabetic(5))
       .setChecksum("checksum_" + randomAlphabetic(5))
       .setTags(newHashSet("tag_" + randomAlphanumeric(5), "tag_" + randomAlphanumeric(5)))