You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by dh...@apache.org on 2016/06/14 01:20:57 UTC
[2/2] incubator-beam git commit: CompressedSourceTest: simplify
CompressedSourceTest: simplify
We should use random.nextBytes(buff) instead of making the array in a loop.
The code we now point to is the same as the for loop, so the test continues to pass.
Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/0abeb068
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/0abeb068
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/0abeb068
Branch: refs/heads/master
Commit: 0abeb068cd3fead73c664a00c0f01a71627658ef
Parents: 5227624
Author: Dan Halperin <dh...@google.com>
Authored: Mon Jun 13 17:34:58 2016 -0700
Committer: Dan Halperin <dh...@google.com>
Committed: Mon Jun 13 18:20:45 2016 -0700
----------------------------------------------------------------------
.../test/java/org/apache/beam/sdk/io/CompressedSourceTest.java | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/0abeb068/sdks/java/core/src/test/java/org/apache/beam/sdk/io/CompressedSourceTest.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/io/CompressedSourceTest.java b/sdks/java/core/src/test/java/org/apache/beam/sdk/io/CompressedSourceTest.java
index 9b44386..c34d2dd 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/io/CompressedSourceTest.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/io/CompressedSourceTest.java
@@ -384,9 +384,7 @@ public class CompressedSourceTest {
// Arbitrary but fixed seed
Random random = new Random(285930);
byte[] buff = new byte[size];
- for (int i = 0; i < size; i++) {
- buff[i] = (byte) (random.nextInt() % Byte.MAX_VALUE);
- }
+ random.nextBytes(buff);
return buff;
}