From a39c73a4136eef5b83e926e80e5dc98c89827846 Mon Sep 17 00:00:00 2001 From: dev-mlb <19797865+dev-mlb@users.noreply.github.com> Date: Thu, 19 Sep 2024 10:58:30 -0400 Subject: [PATCH] errorprone :: LoopOverCharArray --- .../emissary/output/filter/AbstractFilterTest.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/test/java/emissary/output/filter/AbstractFilterTest.java b/src/test/java/emissary/output/filter/AbstractFilterTest.java index 64c4b92ba4..fe98434b16 100644 --- a/src/test/java/emissary/output/filter/AbstractFilterTest.java +++ b/src/test/java/emissary/output/filter/AbstractFilterTest.java @@ -66,7 +66,8 @@ void testDefaultDenylistFiletypeFormat() { String formatString = "Fi1e%sTyp3"; String noMatchChars = " !@#$%^&*()+=\\/.,"; - for (char noMatchChar : noMatchChars.toCharArray()) { + for (int i = 0; i < noMatchChars.length(); i++) { + char noMatchChar = noMatchChars.charAt(i); String noMatch = String.format(formatString, noMatchChar); assertFalse(f.matchesDenylistFiletypeFormatPattern(noMatch), String.format("Unexpected match %s for Pattern %s", noMatch, pattern)); @@ -77,7 +78,8 @@ void testDefaultDenylistFiletypeFormat() { String.format("Expected match %s for Pattern %s", nullInsert, pattern)); String matchChars = "-_"; - for (char matchChar : matchChars.toCharArray()) { + for (int i = 0; i < matchChars.length(); i++) { + char matchChar = matchChars.charAt(i); String match = String.format(formatString, matchChar); assertTrue(f.matchesDenylistFiletypeFormatPattern(match), String.format("Expected match %s for Pattern %s", match, pattern)); @@ -99,7 +101,8 @@ void testDefaultDenylistViewNameFormat() { for (String formatString : formatStrings) { String noMatchChars = " !@#$%^&*()+=\\/,"; - for (char noMatchChar : noMatchChars.toCharArray()) { + for (int i = 0; i < noMatchChars.length(); i++) { + char noMatchChar = noMatchChars.charAt(i); String noMatch = String.format(formatString, noMatchChar); assertFalse(f.matchesDenylistViewNameFormatPattern(noMatch), String.format("Unexpected match %s for Pattern %s", noMatch, pattern)); @@ -110,7 +113,8 @@ void testDefaultDenylistViewNameFormat() { String.format("Expected match %s for Pattern %s", nullInsert, pattern)); String matchChars = "-_"; - for (char matchChar : matchChars.toCharArray()) { + for (int i = 0; i < matchChars.length(); i++) { + char matchChar = matchChars.charAt(i); String match = String.format(formatString, matchChar); assertTrue(f.matchesDenylistViewNameFormatPattern(match), String.format("Expected match %s for Pattern %s", match, pattern));