Use Arrays.fill().

This commit is contained in:
Gary Gregory 2020-11-23 10:54:36 -05:00 committed by Gary Gregory
parent 460abd7474
commit b7f851104a
1 changed files with 7 additions and 18 deletions

View File

@ -29,6 +29,7 @@ package org.apache.hc.client5.http.impl.cache;
import java.io.IOException;
import java.io.InputStream;
import java.net.SocketTimeoutException;
import java.util.Arrays;
import java.util.Date;
import java.util.Iterator;
import java.util.Random;
@ -1380,9 +1381,7 @@ public class TestProtocolRequirements extends AbstractProtocolTest {
resp1.setHeader("Cache-Control", "max-age=3600");
resp1.setHeader("ETag", "\"etag1\"");
final byte[] bytes1 = new byte[128];
for (int i = 0; i < bytes1.length; i++) {
bytes1[i] = (byte) 1;
}
Arrays.fill(bytes1, (byte) 1);
resp1.setEntity(new ByteArrayEntity(bytes1, null));
final ClassicHttpRequest req2 = new BasicClassicHttpRequest("GET", "/");
@ -1397,9 +1396,7 @@ public class TestProtocolRequirements extends AbstractProtocolTest {
resp2.setHeader("ETag", "\"etag2\"");
resp2.setHeader("Content-Range", "bytes 0-50/128");
final byte[] bytes2 = new byte[51];
for (int i = 0; i < bytes2.length; i++) {
bytes2[i] = (byte) 2;
}
Arrays.fill(bytes2, (byte) 2);
resp2.setEntity(new ByteArrayEntity(bytes2, null));
final Date inTwoSeconds = new Date(now.getTime() + 2000L);
@ -1409,9 +1406,7 @@ public class TestProtocolRequirements extends AbstractProtocolTest {
resp3.setHeader("Cache-Control", "max-age=3600");
resp3.setHeader("ETag", "\"etag2\"");
final byte[] bytes3 = new byte[128];
for (int i = 0; i < bytes3.length; i++) {
bytes3[i] = (byte) 2;
}
Arrays.fill(bytes3, (byte) 2);
resp3.setEntity(new ByteArrayEntity(bytes3, null));
EasyMock.expect(
@ -1461,9 +1456,7 @@ public class TestProtocolRequirements extends AbstractProtocolTest {
resp1.setHeader("Cache-Control", "max-age=3600");
resp1.setHeader("Last-Modified", DateUtils.formatDate(oneHourAgo));
final byte[] bytes1 = new byte[128];
for (int i = 0; i < bytes1.length; i++) {
bytes1[i] = (byte) 1;
}
Arrays.fill(bytes1, (byte) 1);
resp1.setEntity(new ByteArrayEntity(bytes1, null));
final ClassicHttpRequest req2 = new BasicClassicHttpRequest("GET", "/");
@ -1478,9 +1471,7 @@ public class TestProtocolRequirements extends AbstractProtocolTest {
resp2.setHeader("Last-Modified", DateUtils.formatDate(now));
resp2.setHeader("Content-Range", "bytes 0-50/128");
final byte[] bytes2 = new byte[51];
for (int i = 0; i < bytes2.length; i++) {
bytes2[i] = (byte) 2;
}
Arrays.fill(bytes2, (byte) 2);
resp2.setEntity(new ByteArrayEntity(bytes2, null));
final Date inTwoSeconds = new Date(now.getTime() + 2000L);
@ -1490,9 +1481,7 @@ public class TestProtocolRequirements extends AbstractProtocolTest {
resp3.setHeader("Cache-Control", "max-age=3600");
resp3.setHeader("ETag", "\"etag2\"");
final byte[] bytes3 = new byte[128];
for (int i = 0; i < bytes3.length; i++) {
bytes3[i] = (byte) 2;
}
Arrays.fill(bytes3, (byte) 2);
resp3.setEntity(new ByteArrayEntity(bytes3, null));
EasyMock.expect(