Commit e8b7d0fc authored by Andy Wilkinson's avatar Andy Wilkinson

Polish

parent 70eee612
/* /*
* Copyright 2012-2018 the original author or authors. * Copyright 2012-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -560,7 +560,7 @@ public class TomcatEmbeddedServletContainerFactoryTests ...@@ -560,7 +560,7 @@ public class TomcatEmbeddedServletContainerFactoryTests
throws IOException, URISyntaxException { throws IOException, URISyntaxException {
TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory( TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory(
0); 0);
AtomicReference<ServletContext> servletContextReference = new AtomicReference<>(); final AtomicReference<ServletContext> servletContextReference = new AtomicReference<ServletContext>();
factory.addInitializers(new ServletContextInitializer() { factory.addInitializers(new ServletContextInitializer() {
@Override @Override
...@@ -588,11 +588,11 @@ public class TomcatEmbeddedServletContainerFactoryTests ...@@ -588,11 +588,11 @@ public class TomcatEmbeddedServletContainerFactoryTests
FileSystemUtils.deleteRecursively(temp); FileSystemUtils.deleteRecursively(temp);
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
MultiValueMap<String, Object> body = new LinkedMultiValueMap<>(); MultiValueMap<String, Object> body = new LinkedMultiValueMap<String, Object>();
body.add("file", new ByteArrayResource(new byte[1024 * 1024])); body.add("file", new ByteArrayResource(new byte[1024 * 1024]));
headers.setContentType(MediaType.MULTIPART_FORM_DATA); headers.setContentType(MediaType.MULTIPART_FORM_DATA);
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(body, HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<MultiValueMap<String, Object>>(
headers); body, headers);
ResponseEntity<String> response = restTemplate ResponseEntity<String> response = restTemplate
.postForEntity(getLocalUrl("/upload"), requestEntity, String.class); .postForEntity(getLocalUrl("/upload"), requestEntity, String.class);
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment