Skip to content

Commit

Permalink
Merge f7fa4e5 into a4186a0
Browse files Browse the repository at this point in the history
  • Loading branch information
arturobernalg committed May 1, 2021
2 parents a4186a0 + f7fa4e5 commit 3295813
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package org.apache.commons.fileupload2;

import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand All @@ -27,7 +28,6 @@
import java.io.IOException;
import java.io.OutputStream;
import java.io.UncheckedIOException;
import java.util.Arrays;
import org.apache.commons.io.FileUtils;


Expand Down Expand Up @@ -126,7 +126,7 @@ public void testBelowThreshold() {
assertTrue(item.isInMemory());
assertEquals(item.getSize(), testFieldValueBytes.length);
try {
assertTrue(Arrays.equals(item.get(), testFieldValueBytes));
assertArrayEquals(item.get(), testFieldValueBytes);
} catch (UncheckedIOException e) {
fail("Unexpected IOException", e);
}
Expand Down Expand Up @@ -189,7 +189,7 @@ public void doTestAboveThreshold(final File repository) {
assertFalse(item.isInMemory());
assertEquals(item.getSize(), testFieldValueBytes.length);
try {
assertTrue(Arrays.equals(item.get(), testFieldValueBytes));
assertArrayEquals(item.get(), testFieldValueBytes);
} catch (UncheckedIOException e) {
fail("Unexpected IOException", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,27 @@ public void testParsing() {
"test; test1 = stuff ; test2 = \"stuff; stuff\"; test3=\"stuff";
final ParameterParser parser = new ParameterParser();
Map<String, String> params = parser.parse(s, ';');
assertEquals(null, params.get("test"));
assertNull(params.get("test"));
assertEquals("stuff", params.get("test1"));
assertEquals("stuff; stuff", params.get("test2"));
assertEquals("\"stuff", params.get("test3"));

params = parser.parse(s, new char[] { ',', ';' });
assertEquals(null, params.get("test"));
assertNull(params.get("test"));
assertEquals("stuff", params.get("test1"));
assertEquals("stuff; stuff", params.get("test2"));
assertEquals("\"stuff", params.get("test3"));

s = " test , test1=stuff , , test2=, test3, ";
params = parser.parse(s, ',');
assertEquals(null, params.get("test"));
assertNull(params.get("test"));
assertEquals("stuff", params.get("test1"));
assertEquals(null, params.get("test2"));
assertEquals(null, params.get("test3"));
assertNull(params.get("test2"));
assertNull(params.get("test3"));

s = " test";
params = parser.parse(s, ';');
assertEquals(null, params.get("test"));
assertNull(params.get("test"));

s = " ";
params = parser.parse(s, ';');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.apache.commons.fileupload2;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.apache.commons.fileupload2;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

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

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

0 comments on commit 3295813

Please sign in to comment.