Skip to content
Permalink
Browse files
Replace indexOf() with contains()
  • Loading branch information
arturobernalg committed May 25, 2021
1 parent 5b5e8a6 commit 7f02be4a08481fe319126b797353f641e9a42214
Showing 2 changed files with 3 additions and 3 deletions.
@@ -95,7 +95,7 @@ private MimeUtility() {
public static String decodeText(final String text) throws UnsupportedEncodingException {
// if the text contains any encoded tokens, those tokens will be marked with "=?". If the
// source string doesn't contain that sequent, no decoding is required.
if (text.indexOf(ENCODED_TOKEN_MARKER) < 0) {
if (!text.contains(ENCODED_TOKEN_MARKER)) {
return text;
}

@@ -265,7 +265,7 @@ public void testInvalidFileNameException() throws Exception {
} catch (final InvalidFileNameException e) {
assertEquals(fileName, e.getName());
assertEquals(-1, e.getMessage().indexOf(fileName));
assertTrue(e.getMessage().indexOf("foo.exe\\0.png") != -1);
assertTrue(e.getMessage().contains("foo.exe\\0.png"));
}

try {
@@ -274,7 +274,7 @@ public void testInvalidFileNameException() throws Exception {
} catch (final InvalidFileNameException e) {
assertEquals(fileName, e.getName());
assertEquals(-1, e.getMessage().indexOf(fileName));
assertTrue(e.getMessage().indexOf("foo.exe\\0.png") != -1);
assertTrue(e.getMessage().contains("foo.exe\\0.png"));
}
}

0 comments on commit 7f02be4

Please sign in to comment.