Skip to content

Commit

Permalink
Basic test for FileUpload-ItemIterator
Browse files Browse the repository at this point in the history
  • Loading branch information
solomax committed Oct 13, 2023
1 parent 9e5a555 commit f3aa896
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

import org.apache.commons.fileupload2.core.AbstractFileUploadTest;
import org.apache.commons.fileupload2.core.Constants;
Expand Down Expand Up @@ -107,6 +108,14 @@ public void parseParameterMap() throws Exception {

assertTrue(mappedParameters.containsKey("multi"));
assertEquals(2, mappedParameters.get("multi").size());

final var itemCount = new AtomicInteger(0);
// Replace iterator with this one to make test passed
//upload.getItemIterator(new JakartaMockServletHttpRequest(bytes, Constants.CONTENT_TYPE)).forEachRemaining(item -> {
upload.getItemIterator(request).forEachRemaining(item -> {
itemCount.incrementAndGet();
});
assertEquals(4, itemCount.get());
}

@Override
Expand Down

0 comments on commit f3aa896

Please sign in to comment.