Skip to content

Commit b1e1727

Browse files
committed
switched to ThreadLocalRandom.current() instead of static variable
1 parent d62371d commit b1e1727

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/test/java/pl/project13/maven/git/GitIntegrationTest.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,12 @@
2929
import java.io.IOException;
3030
import java.util.HashMap;
3131
import java.util.Map;
32-
import java.util.Random;
32+
import java.util.concurrent.ThreadLocalRandom;
3333

3434
import static org.mockito.internal.util.reflection.Whitebox.setInternalState;
3535

3636
public abstract class GitIntegrationTest {
3737

38-
/**
39-
* Random number generator for generating random sandbox folder names.
40-
*/
41-
private final static Random r = new Random();
42-
4338
private final static String SANDBOX_DIR = "target" + File.separator + "sandbox" + File.separator;
4439

4540
/**
@@ -55,7 +50,7 @@ public void setUp() throws Exception {
5550
// generate unique sandbox for this test
5651
File sandbox;
5752
do {
58-
currSandbox = SANDBOX_DIR + "sandbox" + Integer.toString(r.nextInt(Integer.MAX_VALUE));
53+
currSandbox = SANDBOX_DIR + "sandbox" + Integer.toString(ThreadLocalRandom.current().nextInt(Integer.MAX_VALUE));
5954
sandbox = new File(currSandbox);
6055
} while (sandbox.exists());
6156

0 commit comments

Comments
 (0)