Skip to content

Commit

Permalink
CharArraysTests: Fix test bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpountz committed Aug 16, 2018
1 parent 7f6802c commit 039babd
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -55,7 +55,10 @@ public void testCharsBeginsWith() {
assertTrue(CharArrays.charsBeginsWith(prefix, prefixedValue));

final String modifiedPrefix = randomBoolean() ? prefix.substring(1) : prefix.substring(0, prefix.length() - 1);
final char[] nonMatchingValue = modifiedPrefix.concat(randomAlphaOfLengthBetween(0, 12)).toCharArray();
char[] nonMatchingValue;
do {
nonMatchingValue = modifiedPrefix.concat(randomAlphaOfLengthBetween(0, 12)).toCharArray();
} while (new String(nonMatchingValue).startsWith(prefix));
assertFalse(CharArrays.charsBeginsWith(prefix, nonMatchingValue));
assertTrue(CharArrays.charsBeginsWith(modifiedPrefix, nonMatchingValue));
}
Expand Down

0 comments on commit 039babd

Please sign in to comment.