Skip to content
Permalink
Browse files
[WARNING] Manual calls to Math.max
Using Math.max is more explicit and thus
should be favored.
  • Loading branch information
chibenwa committed May 28, 2021
1 parent 66bb16c commit 7cabf17f4b8bdd4944b2f4c3685effd53c233da7
Showing 1 changed file with 3 additions and 3 deletions.
@@ -69,7 +69,7 @@ private void testConvertBoth(String s1, String s2) throws IOException {
new EOLConvertingInputStream(InputStreams.createAscii(s1),
EOLConvertingInputStream.CONVERT_BOTH);
int n = in.read(bytes);
Assert.assertEquals(s2, ContentUtil.toAsciiString(bytes, 0, n > 0 ? n : 0));
Assert.assertEquals(s2, ContentUtil.toAsciiString(bytes, 0, Math.max(n, 0)));

in.close();
}
@@ -81,7 +81,7 @@ private void testConvertCR(String s1, String s2) throws IOException {
new EOLConvertingInputStream(InputStreams.createAscii(s1),
EOLConvertingInputStream.CONVERT_CR);
int n = in.read(bytes);
Assert.assertEquals(s2, ContentUtil.toAsciiString(bytes, 0, n > 0 ? n : 0));
Assert.assertEquals(s2, ContentUtil.toAsciiString(bytes, 0, Math.max(n, 0)));

in.close();
}
@@ -93,7 +93,7 @@ private void testConvertLF(String s1, String s2) throws IOException {
new EOLConvertingInputStream(InputStreams.createAscii(s1),
EOLConvertingInputStream.CONVERT_LF);
int n = in.read(bytes);
Assert.assertEquals(s2, ContentUtil.toAsciiString(bytes, 0, n > 0 ? n : 0));
Assert.assertEquals(s2, ContentUtil.toAsciiString(bytes, 0, Math.max(n, 0)));

in.close();
}

0 comments on commit 7cabf17

Please sign in to comment.