// Path: upload-parser-core/src/main/java/com/github/elopteryx/upload/errors/PartSizeException.java
// public class PartSizeException extends UploadSizeException {
// 
//     /**
//      * Public constructor.
//      * @param message The message of the exception
//      * @param actual The known size at the time of the exception
//      * @param permitted The maximum permitted size
//      */
//     public PartSizeException(final String message, final long actual, final long permitted) {
//         super(message, actual, permitted);
//     }
// }
// 
// Path: upload-parser-core/src/main/java/com/github/elopteryx/upload/errors/RequestSizeException.java
// public class RequestSizeException extends UploadSizeException {
// 
//     /**
//      * Public constructor.
//      * @param message The message of the exception
//      * @param actual The known size at the time of the exception in bytes
//      * @param permitted The maximum permitted size in bytes
//      */
//     public RequestSizeException(final String message, final long actual, final long permitted) {
//         super(message, actual, permitted);
//     }
// }
// 
// Path: upload-parser-tests/src/test/java/com/github/elopteryx/upload/util/Servlets.java
// public final class Servlets {
// 
//     private Servlets() {
//         // No need to instantiate
//     }
// 
//     /**
//      * Creates a new mock servlet request.
//      * @return The mocked request.
//      * @throws Exception If an error occurred
//      */
//     public static HttpServletRequest newRequest() throws Exception {
//         final var request = mock(HttpServletRequest.class);
// 
//         when(request.getMethod()).thenReturn("POST");
//         when(request.getContentType()).thenReturn("multipart/");
//         when(request.getContentLengthLong()).thenReturn(1024 * 1024L);
//         when(request.getInputStream()).thenReturn(new MockServletInputStream());
//         when(request.isAsyncSupported()).thenReturn(true);
// 
//         return request;
//     }
// 
//     /**
//      * Creates a new mock servlet response.
//      * @return The mocked response.
//      */
//     public static HttpServletResponse newResponse() {
//         final var response = mock(HttpServletResponse.class);
// 
//         when(response.getStatus()).thenReturn(200);
// 
//         return response;
//     }
// }


import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.when;
import com.github.elopteryx.upload.errors.PartSizeException;
import com.github.elopteryx.upload.errors.RequestSizeException;
import com.github.elopteryx.upload.util.Servlets;
import org.junit.jupiter.api.Test;
package com.github.elopteryx.upload.internal;



class AbstractUploadParserTest {

    private static final long SIZE = 1024 * 1024 * 100L;
    private static final long SMALL_SIZE = 1024;

    private AbstractUploadParser runSetupForSize(final long requestSize, final long allowedRequestSize, final long allowedPartSize) throws Exception {
        final var request = Servlets.newRequest();

        when(request.getContentLengthLong()).thenReturn(requestSize);

        final var parser = new AsyncUploadParser(request);
// Path: upload-parser-core/src/main/java/com/github/elopteryx/upload/errors/PartSizeException.java
// public class PartSizeException extends UploadSizeException {
// 
//     /**
//      * Public constructor.
//      * @param message The message of the exception
//      * @param actual The known size at the time of the exception
//      * @param permitted The maximum permitted size
//      */
//     public PartSizeException(final String message, final long actual, final long permitted) {
//         super(message, actual, permitted);
//     }
// }
// 
// Path: upload-parser-core/src/main/java/com/github/elopteryx/upload/errors/RequestSizeException.java
// public class RequestSizeException extends UploadSizeException {
// 
//     /**
//      * Public constructor.
//      * @param message The message of the exception
//      * @param actual The known size at the time of the exception in bytes
//      * @param permitted The maximum permitted size in bytes
//      */
//     public RequestSizeException(final String message, final long actual, final long permitted) {
//         super(message, actual, permitted);
//     }
// }
// 
// Path: upload-parser-tests/src/test/java/com/github/elopteryx/upload/util/Servlets.java
// public final class Servlets {
// 
//     private Servlets() {
//         // No need to instantiate
//     }
// 
//     /**
//      * Creates a new mock servlet request.
//      * @return The mocked request.
//      * @throws Exception If an error occurred
//      */
//     public static HttpServletRequest newRequest() throws Exception {
//         final var request = mock(HttpServletRequest.class);
// 
//         when(request.getMethod()).thenReturn("POST");
//         when(request.getContentType()).thenReturn("multipart/");
//         when(request.getContentLengthLong()).thenReturn(1024 * 1024L);
//         when(request.getInputStream()).thenReturn(new MockServletInputStream());
//         when(request.isAsyncSupported()).thenReturn(true);
// 
//         return request;
//     }
// 
//     /**
//      * Creates a new mock servlet response.
//      * @return The mocked response.
//      */
//     public static HttpServletResponse newResponse() {
//         final var response = mock(HttpServletResponse.class);
// 
//         when(response.getStatus()).thenReturn(200);
// 
//         return response;
//     }
// }


// Path: upload-parser-tests/src/test/java/com/github/elopteryx/upload/internal/AbstractUploadParserTest.java
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.when;
import com.github.elopteryx.upload.errors.PartSizeException;
import com.github.elopteryx.upload.errors.RequestSizeException;
import com.github.elopteryx.upload.util.Servlets;
import org.junit.jupiter.api.Test;

package com.github.elopteryx.upload.internal;



class AbstractUploadParserTest {

    private static final long SIZE = 1024 * 1024 * 100L;
    private static final long SMALL_SIZE = 1024;

    private AbstractUploadParser runSetupForSize(final long requestSize, final long allowedRequestSize, final long allowedPartSize) throws Exception {
        final var request = Servlets.newRequest();

        when(request.getContentLengthLong()).thenReturn(requestSize);

        final var parser = new AsyncUploadParser(request);
        parser.setMaxPartSize(allowedPartSize);