Skip to content

Commit

Permalink
errorprone :: LoopOverCharArray
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-mlb committed Sep 19, 2024
1 parent 11b64f6 commit a39c73a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/test/java/emissary/output/filter/AbstractFilterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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));
Expand All @@ -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));
Expand All @@ -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));
Expand Down

0 comments on commit a39c73a

Please sign in to comment.