From c1930c80c611f72e9ebd9084afb7ca4e06032a12 Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Thu, 8 Dec 2022 14:18:08 -0800 Subject: [PATCH] Use String.repeat --- src/test/java/com/maxmind/db/DecoderTest.java | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/test/java/com/maxmind/db/DecoderTest.java b/src/test/java/com/maxmind/db/DecoderTest.java index adf9d322..d8f71057 100644 --- a/src/test/java/com/maxmind/db/DecoderTest.java +++ b/src/test/java/com/maxmind/db/DecoderTest.java @@ -152,21 +152,21 @@ private static Map 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; @@ -187,14 +187,6 @@ private static Map 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 tests, byte ctrl, String str) { DecoderTest.addTestString(tests, new byte[]{ctrl}, str);