  @Test
  public void setServletParameters_supportUpload(@Mocked ServletContext servletContext, @Mocked Dynamic d1,
      @Mocked ServletRegistration d2) throws IOException {

    Map<String, ServletRegistration> servletRegistrations = new HashMap<>();
    servletRegistrations.put("d1", d1);
    servletRegistrations.put("d2", d2);
    new Expectations() {
      {
        servletContext.getServletRegistrations();
        result = servletRegistrations;
        d1.getClassName();
        result = RestServlet.class.getName();
        d2.getClassName();
        result = HttpServlet.class.getName();
      }
    };

    List<MultipartConfigElement> multipartConfigs = new ArrayList<>();
    new MockUp<Dynamic>(d1) {
      @Mock
      void setMultipartConfig(MultipartConfigElement multipartConfig) {
        multipartConfigs.add(multipartConfig);
      }
    };

    File tempDir = Files.createTempDirectory("temp").toFile();
    File uploadDir = new File(tempDir, "upload");
    ArchaiusUtils.setProperty(RestConst.UPLOAD_DIR, uploadDir.getAbsolutePath());

    ServletUtils.setServletParameters(servletContext);

    Assert.assertEquals(1, multipartConfigs.size());

    MultipartConfigElement multipartConfigElement = multipartConfigs.get(0);
    Assert.assertEquals(uploadDir.getAbsolutePath(), multipartConfigElement.getLocation());
    Assert.assertEquals(-1, multipartConfigElement.getMaxFileSize());
    Assert.assertEquals(-1, multipartConfigElement.getMaxRequestSize());
    Assert.assertEquals(0, multipartConfigElement.getFileSizeThreshold());

    uploadDir.delete();
    tempDir.delete();
    Assert.assertFalse(tempDir.exists());
  }