summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2018-01-11 14:22:09 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2018-01-11 14:23:21 +0900
commit1842c70b8da5383a698d6adcd8c9ca68310100ef (patch)
treefa19d57379f73fd130a83176be3d77c6437f86e8 /org.eclipse.jgit.test
parentdadbdcdcfcc2c19165047a75bf617e5000cfc445 (diff)
downloadjgit-1842c70b8da5383a698d6adcd8c9ca68310100ef.tar.gz
jgit-1842c70b8da5383a698d6adcd8c9ca68310100ef.zip
PackInserterTest#newLargeBlob: Factor Random instance out to class member
Instead of instantiating a new Random on each invocation of newLargeBlob, create it once and reuse it. This fixes a warning raised by Spotbugs about the Random object being created and only used once. Change-Id: I5b8e6ccbbc92641811537808aed9eae2034c1133 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackInserterTest.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackInserterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackInserterTest.java
index b782ce87ff..8e438bc0e0 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackInserterTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackInserterTest.java
@@ -95,6 +95,8 @@ import org.junit.Test;
public class PackInserterTest extends RepositoryTestCase {
private WindowCacheConfig origWindowCacheConfig;
+ private static final Random random = new Random(0);
+
@Before
public void setWindowCacheConfig() {
origWindowCacheConfig = new WindowCacheConfig();
@@ -518,7 +520,7 @@ public class PackInserterTest extends RepositoryTestCase {
private static byte[] newLargeBlob() {
byte[] blob = new byte[10240];
- new Random(0).nextBytes(blob);
+ random.nextBytes(blob);
return blob;
}