|
24 | 24 | import static org.junit.Assert.assertNull; |
25 | 25 | import static org.junit.Assert.assertTrue; |
26 | 26 |
|
| 27 | +import com.google.common.collect.Iterables; |
| 28 | +import com.google.common.collect.Lists; |
27 | 29 | import com.google.protobuf.ByteString; |
28 | 30 | import io.grpc.CallOptions; |
29 | 31 | import io.grpc.Channel; |
|
53 | 55 | import io.grpc.testing.integration.TestServiceGrpc.TestServiceBlockingStub; |
54 | 56 | import io.grpc.testing.integration.TransportCompressionTest.Fzip; |
55 | 57 | import java.nio.charset.Charset; |
56 | | -import java.util.ArrayList; |
57 | | -import java.util.Collection; |
58 | 58 | import java.util.List; |
59 | 59 | import java.util.concurrent.Executors; |
60 | 60 | import java.util.concurrent.ScheduledExecutorService; |
@@ -146,25 +146,16 @@ public void tearDown() { |
146 | 146 | * Parameters for test. |
147 | 147 | */ |
148 | 148 | @Parameters |
149 | | - public static Collection<Object[]> params() { |
150 | | - boolean[] bools = new boolean[]{false, true}; |
151 | | - List<Object[]> combos = new ArrayList<>(64); |
152 | | - for (boolean enableClientMessageCompression : bools) { |
153 | | - for (boolean clientAcceptEncoding : bools) { |
154 | | - for (boolean clientEncoding : bools) { |
155 | | - for (boolean enableServerMessageCompression : bools) { |
156 | | - for (boolean serverAcceptEncoding : bools) { |
157 | | - for (boolean serverEncoding : bools) { |
158 | | - combos.add(new Object[] { |
159 | | - enableClientMessageCompression, clientAcceptEncoding, clientEncoding, |
160 | | - enableServerMessageCompression, serverAcceptEncoding, serverEncoding}); |
161 | | - } |
162 | | - } |
163 | | - } |
164 | | - } |
165 | | - } |
166 | | - } |
167 | | - return combos; |
| 149 | + public static Iterable<Object[]> params() { |
| 150 | + List<Boolean> bools = Lists.newArrayList(false, true); |
| 151 | + return Iterables.transform(Lists.cartesianProduct( |
| 152 | + bools, // enableClientMessageCompression |
| 153 | + bools, // clientAcceptEncoding |
| 154 | + bools, // clientEncoding |
| 155 | + bools, // enableServerMessageCompression |
| 156 | + bools, // serverAcceptEncoding |
| 157 | + bools // serverEncoding |
| 158 | + ), List::toArray); |
168 | 159 | } |
169 | 160 |
|
170 | 161 | @Test |
|
0 commit comments