Skip to content

Commit

Permalink
Use String.repeat
Browse files Browse the repository at this point in the history
  • Loading branch information
oschwald committed Dec 9, 2022
1 parent c3da6fe commit c1930c8
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions src/test/java/com/maxmind/db/DecoderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,21 +152,21 @@ private static Map<String, byte[]> strings() {
DecoderTest.addTestString(strings, new byte[]{0x5d, 0x0},
"12345678901234567890123456789");
DecoderTest.addTestString(strings, new byte[]{0x5d, (byte) 128},
DecoderTest.xString(157));
"x".repeat(157));

DecoderTest
.addTestString(strings, new byte[]{0x5d, 0x0, (byte) 0xd7},
DecoderTest.xString(500));
"x".repeat(500));

DecoderTest
.addTestString(strings, new byte[]{0x5e, 0x0, (byte) 0xd7},
DecoderTest.xString(500));
"x".repeat(500));
DecoderTest.addTestString(strings,
new byte[]{0x5e, 0x6, (byte) 0xb3},
DecoderTest.xString(2000));
"x".repeat(2000));
DecoderTest.addTestString(strings,
new byte[]{0x5f, 0x0, 0x10, 0x53,},
DecoderTest.xString(70000));
"x".repeat(70000));

return strings;

Expand All @@ -187,14 +187,6 @@ private static Map<byte[], byte[]> bytes() {
return bytes;
}

private static String xString(int length) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < length; i++) {
sb.append("x");
}
return sb.toString();
}

private static void addTestString(Map<String, byte[]> tests, byte ctrl,
String str) {
DecoderTest.addTestString(tests, new byte[]{ctrl}, str);
Expand Down

0 comments on commit c1930c8

Please sign in to comment.