We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents bb998a3 + 8a136fb commit 28c39d2Copy full SHA for 28c39d2
core-java-modules/core-java-numbers-7/src/test/java/com/baeldung/securerandompositivelong/SecureRandomPositiveLongUnitTest.java
@@ -0,0 +1,18 @@
1
+package com.baeldung.securerandompositivelong;
2
+
3
+import org.junit.jupiter.api.Test;
4
5
+import java.security.SecureRandom;
6
7
+import static org.assertj.core.api.Assertions.assertThat;
8
9
+public class SecureRandomPositiveLongUnitTest {
10
11
+ @Test
12
+ void whenGenerateRandomPositiveLong_thenGetPositiveValue() {
13
+ SecureRandom secureRandom = new SecureRandom();
14
+ long randomPositiveLong = Math.abs(secureRandom.nextLong());
15
16
+ assertThat(randomPositiveLong).isNotNegative();
17
+ }
18
+}
0 commit comments