diff options
author | Belen Pruvost <belen.pruvost@sonarsource.com> | 2021-10-26 09:33:00 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2021-10-26 20:03:36 +0000 |
commit | 5c3a973802191bec47083ae0b3ca27f4818a4fae (patch) | |
tree | fb22e6b191af02c9bdb58df8df34d4efc04fa3a5 | |
parent | d609879b84b61b8aa9c9c7c4bf95c10a07288823 (diff) | |
download | sonarqube-5c3a973802191bec47083ae0b3ca27f4818a4fae.tar.gz sonarqube-5c3a973802191bec47083ae0b3ca27f4818a4fae.zip |
[NO-JIRA] Fix Quality Gate
-rw-r--r-- | sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/utils/AlwaysIncreasingSystem2.java | 4 | ||||
-rw-r--r-- | sonar-plugin-api/src/test/java/org/sonar/api/utils/DurationTest.java | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/utils/AlwaysIncreasingSystem2.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/utils/AlwaysIncreasingSystem2.java index 0038733b2e4..c0fb5b70b87 100644 --- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/utils/AlwaysIncreasingSystem2.java +++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/utils/AlwaysIncreasingSystem2.java @@ -19,7 +19,7 @@ */ package org.sonar.api.impl.utils; -import java.util.Random; +import java.security.SecureRandom; import java.util.concurrent.atomic.AtomicLong; import java.util.function.Supplier; import org.sonar.api.utils.System2; @@ -34,7 +34,7 @@ import static org.sonar.api.utils.Preconditions.checkArgument; * </p> */ public class AlwaysIncreasingSystem2 extends System2 { - private static final Random rnd = new Random(); + private static final SecureRandom rnd = new SecureRandom(); private final AtomicLong now; private final long increment; diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/DurationTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/DurationTest.java index 13a3ed405b5..28b86d006f7 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/DurationTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/DurationTest.java @@ -129,12 +129,12 @@ public class DurationTest { Duration durationWithSameValue = Duration.create(ONE_DAY_IN_MINUTES + ONE_HOUR_IN_MINUTES + ONE_MINUTE); Duration durationWithDifferentValue = Duration.create(ONE_DAY_IN_MINUTES + ONE_HOUR_IN_MINUTES); - assertThat(duration).isEqualTo(duration); - assertThat(durationWithSameValue).isEqualTo(duration); - assertThat(durationWithDifferentValue).isNotEqualTo(duration); - assertThat(duration).isNotEqualTo(null); - - assertThat(duration).hasSameHashCodeAs(duration); + assertThat(duration) + .isEqualTo(duration) + .isEqualTo(durationWithSameValue) + .isNotEqualTo(durationWithDifferentValue) + .isNotEqualTo(null) + .hasSameHashCodeAs(duration); assertThat(durationWithSameValue).hasSameHashCodeAs(duration); assertThat(durationWithDifferentValue.hashCode()).isNotEqualTo(duration.hashCode()); } |