Skip to content

Commit 92ea663

Browse files
author
David Golombek
committed
Fix up test for repeatability
1 parent e611951 commit 92ea663

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

client/src/test/java/org/asynchttpclient/request/body/PutByteBufTest.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import io.github.artsok.RepeatedIfExceptionsTest;
1616
import io.netty.buffer.ByteBuf;
1717
import io.netty.buffer.Unpooled;
18-
import jakarta.servlet.ServletException;
1918
import jakarta.servlet.http.HttpServletRequest;
2019
import jakarta.servlet.http.HttpServletResponse;
2120
import org.asynchttpclient.AbstractBasicTest;
@@ -24,10 +23,10 @@
2423
import org.eclipse.jetty.server.Request;
2524
import org.eclipse.jetty.server.handler.AbstractHandler;
2625

27-
import java.io.*;
26+
import java.io.IOException;
2827
import java.nio.charset.Charset;
2928
import java.time.Duration;
30-
import java.util.Random;
29+
import java.util.Arrays;
3130

3231
import static org.asynchttpclient.Dsl.asyncHttpClient;
3332
import static org.asynchttpclient.Dsl.config;
@@ -51,8 +50,8 @@ public void testPutSmallBody() throws Exception {
5150

5251
@RepeatedIfExceptionsTest(repeats = 5)
5352
public void testPutBigBody() throws Exception {
54-
byte[] array = new byte[2048]; // length is bounded by 7
55-
new Random().nextBytes(array);
53+
byte[] array = new byte[2048];
54+
Arrays.fill(array, (byte) 97);
5655
String longString = new String(array, Charset.forName("UTF-8"));
5756

5857
put(longString);
@@ -63,7 +62,7 @@ public AbstractHandler configureHandler() throws Exception {
6362
return new AbstractHandler() {
6463

6564
@Override
66-
public void handle(String s, Request request, HttpServletRequest httpRequest, HttpServletResponse response) throws IOException, ServletException {
65+
public void handle(String s, Request request, HttpServletRequest httpRequest, HttpServletResponse response) throws IOException {
6766
int size = 1024;
6867
if (request.getContentLength() > 0) {
6968
size = request.getContentLength();

0 commit comments

Comments
 (0)