Explicit type can be replaced by <>

Issue: SPR-13188
This commit is contained in:
Stephane Nicoll
2016-07-05 17:00:26 +02:00
parent 3096888c7d
commit 00d2606b00
1044 changed files with 3972 additions and 3893 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -119,7 +119,7 @@ public class ServletContextSupportTests {
@Test
public void testServletContextAttributeExporter() {
TestBean tb = new TestBean();
Map<String, Object> attributes = new HashMap<String, Object>();
Map<String, Object> attributes = new HashMap<>();
attributes.put("attr1", "value1");
attributes.put("attr2", tb);
@@ -144,7 +144,7 @@ public class ServletContextSupportTests {
@Test
public void testServletContextResourcePatternResolver() throws IOException {
final Set<String> paths = new HashSet<String>();
final Set<String> paths = new HashSet<>();
paths.add("/WEB-INF/context1.xml");
paths.add("/WEB-INF/context2.xml");
@@ -160,7 +160,7 @@ public class ServletContextSupportTests {
ServletContextResourcePatternResolver rpr = new ServletContextResourcePatternResolver(sc);
Resource[] found = rpr.getResources("/WEB-INF/*.xml");
Set<String> foundPaths = new HashSet<String>();
Set<String> foundPaths = new HashSet<>();
for (Resource resource : found) {
foundPaths.add(((ServletContextResource) resource).getPath());
}
@@ -171,7 +171,7 @@ public class ServletContextSupportTests {
@Test
public void testServletContextResourcePatternResolverWithPatternPath() throws IOException {
final Set<String> dirs = new HashSet<String>();
final Set<String> dirs = new HashSet<>();
dirs.add("/WEB-INF/mydir1/");
dirs.add("/WEB-INF/mydir2/");
@@ -193,7 +193,7 @@ public class ServletContextSupportTests {
ServletContextResourcePatternResolver rpr = new ServletContextResourcePatternResolver(sc);
Resource[] found = rpr.getResources("/WEB-INF/*/*.xml");
Set<String> foundPaths = new HashSet<String>();
Set<String> foundPaths = new HashSet<>();
for (Resource resource : found) {
foundPaths.add(((ServletContextResource) resource).getPath());
}
@@ -204,11 +204,11 @@ public class ServletContextSupportTests {
@Test
public void testServletContextResourcePatternResolverWithUnboundedPatternPath() throws IOException {
final Set<String> dirs = new HashSet<String>();
final Set<String> dirs = new HashSet<>();
dirs.add("/WEB-INF/mydir1/");
dirs.add("/WEB-INF/mydir2/");
final Set<String> paths = new HashSet<String>();
final Set<String> paths = new HashSet<>();
paths.add("/WEB-INF/mydir2/context2.xml");
paths.add("/WEB-INF/mydir2/mydir3/");
@@ -233,7 +233,7 @@ public class ServletContextSupportTests {
ServletContextResourcePatternResolver rpr = new ServletContextResourcePatternResolver(sc);
Resource[] found = rpr.getResources("/WEB-INF/**/*.xml");
Set<String> foundPaths = new HashSet<String>();
Set<String> foundPaths = new HashSet<>();
for (Resource resource : found) {
foundPaths.add(((ServletContextResource) resource).getPath());
}
@@ -245,7 +245,7 @@ public class ServletContextSupportTests {
@Test
public void testServletContextResourcePatternResolverWithAbsolutePaths() throws IOException {
final Set<String> paths = new HashSet<String>();
final Set<String> paths = new HashSet<>();
paths.add("C:/webroot/WEB-INF/context1.xml");
paths.add("C:/webroot/WEB-INF/context2.xml");
paths.add("C:/webroot/someOtherDirThatDoesntContainPath");
@@ -262,7 +262,7 @@ public class ServletContextSupportTests {
ServletContextResourcePatternResolver rpr = new ServletContextResourcePatternResolver(sc);
Resource[] found = rpr.getResources("/WEB-INF/*.xml");
Set<String> foundPaths = new HashSet<String>();
Set<String> foundPaths = new HashSet<>();
for (Resource resource : found) {
foundPaths.add(((ServletContextResource) resource).getPath());
}

View File

@@ -158,7 +158,7 @@ public class ComplexWebApplicationContext extends StaticWebApplicationContext {
pvs = new MutablePropertyValues();
pvs.add("order", "0");
pvs.add("exceptionMappings", "java.lang.Exception=failed1");
List<RuntimeBeanReference> mappedHandlers = new ManagedList<RuntimeBeanReference>();
List<RuntimeBeanReference> mappedHandlers = new ManagedList<>();
mappedHandlers.add(new RuntimeBeanReference("anotherLocaleHandler"));
pvs.add("mappedHandlers", mappedHandlers);
pvs.add("defaultStatusCode", "500");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -84,7 +84,7 @@ public class FlashMapTests {
@Test
public void addTargetRequestParamsNullValue() {
MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
params.add("key", "abc");
params.add("key", " ");
params.add("key", null);
@@ -108,7 +108,7 @@ public class FlashMapTests {
@Test
public void addTargetRequestParamsNullKey() {
MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
params.add(" ", "abc");
params.add(null, " ");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -117,7 +117,7 @@ public class DelegatingWebMvcConfigurationTests {
public void configureMessageConverters() {
final HttpMessageConverter customConverter = mock(HttpMessageConverter.class);
final StringHttpMessageConverter stringConverter = new StringHttpMessageConverter();
List<WebMvcConfigurer> configurers = new ArrayList<WebMvcConfigurer>();
List<WebMvcConfigurer> configurers = new ArrayList<>();
configurers.add(new WebMvcConfigurerAdapter() {
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
@@ -176,7 +176,7 @@ public class DelegatingWebMvcConfigurationTests {
@Test
public void configureExceptionResolvers() throws Exception {
List<WebMvcConfigurer> configurers = new ArrayList<WebMvcConfigurer>();
List<WebMvcConfigurer> configurers = new ArrayList<>();
configurers.add(new WebMvcConfigurerAdapter() {
@Override
public void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) {
@@ -195,7 +195,7 @@ public class DelegatingWebMvcConfigurationTests {
final PathMatcher pathMatcher = mock(PathMatcher.class);
final UrlPathHelper pathHelper = mock(UrlPathHelper.class);
List<WebMvcConfigurer> configurers = new ArrayList<WebMvcConfigurer>();
List<WebMvcConfigurer> configurers = new ArrayList<>();
configurers.add(new WebMvcConfigurerAdapter() {
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -153,7 +153,7 @@ public class InterceptorRegistryTests {
private List<HandlerInterceptor> getInterceptorsForPath(String lookupPath) {
PathMatcher pathMatcher = new AntPathMatcher();
List<HandlerInterceptor> result = new ArrayList<HandlerInterceptor>();
List<HandlerInterceptor> result = new ArrayList<>();
for (Object interceptor : this.registry.getInterceptors()) {
if (interceptor instanceof MappedInterceptor) {
MappedInterceptor mappedInterceptor = (MappedInterceptor) interceptor;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -77,7 +77,7 @@ public class SimpleUrlHandlerMappingTests {
SimpleUrlHandlerMapping handlerMapping = new SimpleUrlHandlerMapping();
handlerMapping.setUrlDecode(false);
Object controller = new Object();
Map<String, Object> urlMap = new LinkedHashMap<String, Object>();
Map<String, Object> urlMap = new LinkedHashMap<>();
urlMap.put("/*/baz", controller);
handlerMapping.setUrlMap(urlMap);
handlerMapping.setApplicationContext(new StaticApplicationContext());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@ public class ExtendedServletRequestDataBinderTests {
@Test
public void createBinder() throws Exception {
Map<String, String> uriTemplateVars = new HashMap<String, String>();
Map<String, String> uriTemplateVars = new HashMap<>();
uriTemplateVars.put("name", "nameValue");
uriTemplateVars.put("age", "25");
request.setAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, uriTemplateVars);
@@ -63,7 +63,7 @@ public class ExtendedServletRequestDataBinderTests {
public void uriTemplateVarAndRequestParam() throws Exception {
request.addParameter("age", "35");
Map<String, String> uriTemplateVars = new HashMap<String, String>();
Map<String, String> uriTemplateVars = new HashMap<>();
uriTemplateVars.put("name", "nameValue");
uriTemplateVars.put("age", "25");
request.setAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, uriTemplateVars);

View File

@@ -77,7 +77,7 @@ public class MatrixVariablesMapMethodArgumentResolverTests {
this.request = new MockHttpServletRequest();
this.webRequest = new ServletWebRequest(request, new MockHttpServletResponse());
Map<String, MultiValueMap<String, String>> params = new LinkedHashMap<String, MultiValueMap<String, String>>();
Map<String, MultiValueMap<String, String>> params = new LinkedHashMap<>();
this.request.setAttribute(HandlerMapping.MATRIX_VARIABLES_ATTRIBUTE, params);
}
@@ -163,7 +163,7 @@ public class MatrixVariablesMapMethodArgumentResolverTests {
(Map<String, MultiValueMap<String, String>>) this.request.getAttribute(
HandlerMapping.MATRIX_VARIABLES_ATTRIBUTE);
MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
matrixVariables.put(pathVarName, params);
return params;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -74,7 +74,7 @@ public class MatrixVariablesMethodArgumentResolverTests {
this.request = new MockHttpServletRequest();
this.webRequest = new ServletWebRequest(request, new MockHttpServletResponse());
Map<String, MultiValueMap<String, String>> params = new LinkedHashMap<String, MultiValueMap<String, String>>();
Map<String, MultiValueMap<String, String>> params = new LinkedHashMap<>();
this.request.setAttribute(HandlerMapping.MATRIX_VARIABLES_ATTRIBUTE, params);
}
@@ -142,7 +142,7 @@ public class MatrixVariablesMethodArgumentResolverTests {
(Map<String, MultiValueMap<String, String>>) this.request.getAttribute(
HandlerMapping.MATRIX_VARIABLES_ATTRIBUTE);
MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
matrixVariables.put(pathVarName, params);
return params;

View File

@@ -53,7 +53,7 @@ public class ModelAndViewResolverMethodReturnValueHandlerTests {
@Before
public void setUp() {
mavResolvers = new ArrayList<ModelAndViewResolver>();
mavResolvers = new ArrayList<>();
handler = new ModelAndViewResolverMethodReturnValueHandler(mavResolvers);
mavContainer = new ModelAndViewContainer();
request = new ServletWebRequest(new MockHttpServletRequest());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -78,7 +78,7 @@ public class PathVariableMapMethodArgumentResolverTests {
@Test
public void resolveArgument() throws Exception {
Map<String, String> uriTemplateVars = new HashMap<String, String>();
Map<String, String> uriTemplateVars = new HashMap<>();
uriTemplateVars.put("name1", "value1");
uriTemplateVars.put("name2", "value2");
request.setAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, uriTemplateVars);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -75,7 +75,7 @@ public class PathVariableMethodArgumentResolverTests {
@Test
public void resolveArgument() throws Exception {
Map<String, String> uriTemplateVars = new HashMap<String, String>();
Map<String, String> uriTemplateVars = new HashMap<>();
uriTemplateVars.put("name", "value");
request.setAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, uriTemplateVars);
@@ -92,7 +92,7 @@ public class PathVariableMethodArgumentResolverTests {
@SuppressWarnings("unchecked")
@Test
public void resolveArgumentWithExistingPathVars() throws Exception {
Map<String, String> uriTemplateVars = new HashMap<String, String>();
Map<String, String> uriTemplateVars = new HashMap<>();
uriTemplateVars.put("name", "value");
request.setAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, uriTemplateVars);

View File

@@ -118,7 +118,7 @@ public class RequestMappingHandlerAdapterIntegrationTests {
ConfigurableWebBindingInitializer bindingInitializer = new ConfigurableWebBindingInitializer();
bindingInitializer.setValidator(new StubValidator());
List<HandlerMethodArgumentResolver> customResolvers = new ArrayList<HandlerMethodArgumentResolver>();
List<HandlerMethodArgumentResolver> customResolvers = new ArrayList<>();
customResolvers.add(new ServletWebArgumentResolverAdapter(new ColorArgumentResolver()));
GenericWebApplicationContext context = new GenericWebApplicationContext();
@@ -172,7 +172,7 @@ public class RequestMappingHandlerAdapterIntegrationTests {
request.setContextPath("/contextPath");
request.setServletPath("/main");
System.setProperty("systemHeader", "systemHeaderValue");
Map<String, String> uriTemplateVars = new HashMap<String, String>();
Map<String, String> uriTemplateVars = new HashMap<>();
uriTemplateVars.put("pathvar", "pathvarValue");
request.setAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, uriTemplateVars);
request.getSession().setAttribute("sessionAttribute", sessionAttribute);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -319,12 +319,12 @@ public class RequestMappingHandlerAdapterTests {
}
public ResponseEntity<Map<String, String>> handleWithResponseEntity() {
return new ResponseEntity<Map<String, String>>(Collections.singletonMap(
return new ResponseEntity<>(Collections.singletonMap(
"foo", "bar"), HttpStatus.OK);
}
public ResponseEntity<String> handleBadRequest() {
return new ResponseEntity<String>("body", HttpStatus.BAD_REQUEST);
return new ResponseEntity<>("body", HttpStatus.BAD_REQUEST);
}
}

View File

@@ -86,7 +86,7 @@ public class RequestMappingHandlerMappingTests {
PathExtensionContentNegotiationStrategy strategy = new PathExtensionContentNegotiationStrategy(fileExtensions);
ContentNegotiationManager manager = new ContentNegotiationManager(strategy);
final Set<String> extensions = new HashSet<String>();
final Set<String> extensions = new HashSet<>();
RequestMappingHandlerMapping hm = new RequestMappingHandlerMapping() {
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -183,14 +183,14 @@ public class RequestPartIntegrationTests {
}
private void testCreate(String url, String basename) {
MultiValueMap<String, Object> parts = new LinkedMultiValueMap<String, Object>();
parts.add("json-data", new HttpEntity<TestData>(new TestData(basename)));
MultiValueMap<String, Object> parts = new LinkedMultiValueMap<>();
parts.add("json-data", new HttpEntity<>(new TestData(basename)));
parts.add("file-data", new ClassPathResource("logo.jpg", getClass()));
parts.add("empty-data", new HttpEntity<byte[]>(new byte[0])); // SPR-12860
parts.add("empty-data", new HttpEntity<>(new byte[0])); // SPR-12860
HttpHeaders headers = new HttpHeaders();
headers.setContentType(new MediaType("application", "octet-stream", Charset.forName("ISO-8859-1")));
parts.add("iso-8859-1-data", new HttpEntity<byte[]>(new byte[] {(byte) 0xC4}, headers)); // SPR-13096
parts.add("iso-8859-1-data", new HttpEntity<>(new byte[] {(byte) 0xC4}, headers)); // SPR-13096
URI location = restTemplate.postForLocation(url, parts);
assertEquals("http://localhost:8080/test/" + basename + "/logo.jpg", location.toString());
@@ -245,7 +245,7 @@ public class RequestPartIntegrationTests {
String url = "http://localhost:8080/test/" + testData.getName() + "/" + file.get().getOriginalFilename();
HttpHeaders headers = new HttpHeaders();
headers.setLocation(URI.create(url));
return new ResponseEntity<Object>(headers, HttpStatus.CREATED);
return new ResponseEntity<>(headers, HttpStatus.CREATED);
}
@RequestMapping(value = "/spr13319", method = POST, consumes = "multipart/form-data")

View File

@@ -313,7 +313,7 @@ public class ServletAnnotationControllerHandlerMethodTests extends AbstractServl
assertEquals("Invalid response status", HttpServletResponse.SC_METHOD_NOT_ALLOWED, response.getStatus());
String allowHeader = response.getHeader("Allow");
assertNotNull("No Allow header", allowHeader);
Set<String> allowedMethods = new HashSet<String>();
Set<String> allowedMethods = new HashSet<>();
allowedMethods.addAll(Arrays.asList(StringUtils.delimitedListToStringArray(allowHeader, ", ")));
assertEquals("Invalid amount of supported methods", 6, allowedMethods.size());
assertTrue("PUT not allowed", allowedMethods.contains("PUT"));
@@ -614,7 +614,7 @@ public class ServletAnnotationControllerHandlerMethodTests extends AbstractServl
wac.registerBeanDefinition("viewResolver", new RootBeanDefinition(TestViewResolver.class));
RootBeanDefinition adapterDef = new RootBeanDefinition(RequestMappingHandlerAdapter.class);
adapterDef.getPropertyValues().add("webBindingInitializer", new MyWebBindingInitializer());
List<HandlerMethodArgumentResolver> argumentResolvers = new ArrayList<HandlerMethodArgumentResolver>();
List<HandlerMethodArgumentResolver> argumentResolvers = new ArrayList<>();
argumentResolvers.add(new ServletWebArgumentResolverAdapter(new MySpecialArgumentResolver()));
adapterDef.getPropertyValues().add("customArgumentResolvers", argumentResolvers);
wac.registerBeanDefinition("handlerAdapter", adapterDef);
@@ -984,7 +984,7 @@ public class ServletAnnotationControllerHandlerMethodTests extends AbstractServl
@Override
public void initialize(GenericWebApplicationContext wac) {
RootBeanDefinition adapterDef = new RootBeanDefinition(RequestMappingHandlerAdapter.class);
List<HttpMessageConverter<?>> messageConverters = new ArrayList<HttpMessageConverter<?>>();
List<HttpMessageConverter<?>> messageConverters = new ArrayList<>();
messageConverters.add(new StringHttpMessageConverter());
messageConverters
.add(new SimpleMessageConverter(new MediaType("application","json"), MediaType.ALL));
@@ -2018,7 +2018,7 @@ public class ServletAnnotationControllerHandlerMethodTests extends AbstractServl
@Override
public List<TestBean> getTestBeans() {
List<TestBean> list = new LinkedList<TestBean>();
List<TestBean> list = new LinkedList<>();
list.add(new TestBean("tb1"));
list.add(new TestBean("tb2"));
return list;
@@ -2044,7 +2044,7 @@ public class ServletAnnotationControllerHandlerMethodTests extends AbstractServl
@Override
@ModelAttribute("testBeanList")
public List<TestBean> getTestBeans() {
List<TestBean> list = new LinkedList<TestBean>();
List<TestBean> list = new LinkedList<>();
list.add(new TestBean("tb1"));
list.add(new TestBean("tb2"));
return list;
@@ -2071,7 +2071,7 @@ public class ServletAnnotationControllerHandlerMethodTests extends AbstractServl
@ModelAttribute("testBeanList")
public List<TestBean> getTestBeans() {
List<TestBean> list = new LinkedList<TestBean>();
List<TestBean> list = new LinkedList<>();
list.add(new TestBean("tb1"));
list.add(new TestBean("tb2"));
return list;
@@ -2108,7 +2108,7 @@ public class ServletAnnotationControllerHandlerMethodTests extends AbstractServl
@ModelAttribute
public List<TestBean> getTestBeans() {
List<TestBean> list = new LinkedList<TestBean>();
List<TestBean> list = new LinkedList<>();
list.add(new TestBean("tb1"));
list.add(new TestBean("tb2"));
return list;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -87,7 +87,7 @@ public class ServletModelAttributeMethodProcessorTests {
@Test
public void createAttributeUriTemplateVar() throws Exception {
Map<String, String> uriTemplateVars = new HashMap<String, String>();
Map<String, String> uriTemplateVars = new HashMap<>();
uriTemplateVars.put("testBean1", "Patty");
this.request.setAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, uriTemplateVars);
@@ -102,7 +102,7 @@ public class ServletModelAttributeMethodProcessorTests {
@Test
public void createAttributeUriTemplateVarCannotConvert() throws Exception {
Map<String, String> uriTemplateVars = new HashMap<String, String>();
Map<String, String> uriTemplateVars = new HashMap<>();
uriTemplateVars.put("testBean2", "Patty");
request.setAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, uriTemplateVars);
@@ -115,7 +115,7 @@ public class ServletModelAttributeMethodProcessorTests {
@Test
public void createAttributeUriTemplateVarWithOptional() throws Exception {
Map<String, String> uriTemplateVars = new HashMap<String, String>();
Map<String, String> uriTemplateVars = new HashMap<>();
uriTemplateVars.put("testBean3", "Patty");
this.request.setAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, uriTemplateVars);

View File

@@ -81,7 +81,7 @@ public class UriTemplateServletAnnotationControllerHandlerMethodTests extends Ab
@Test
public void pathVarsInModel() throws Exception {
final Map<String, Object> pathVars = new HashMap<String, Object>();
final Map<String, Object> pathVars = new HashMap<>();
pathVars.put("hotel", "42");
pathVars.put("booking", 21);
pathVars.put("other", "other");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -98,7 +98,7 @@ public class RedirectAttributesModelMapTests {
@Test
public void addAttributesMap() {
Map<String, Object> map = new HashMap<String, Object>();
Map<String, Object> map = new HashMap<>();
map.put("person", new TestBean("Fred"));
map.put("age", 33);
this.redirectAttributes.addAllAttributes(map);
@@ -109,7 +109,7 @@ public class RedirectAttributesModelMapTests {
@Test
public void mergeAttributes() {
Map<String, Object> map = new HashMap<String, Object>();
Map<String, Object> map = new HashMap<>();
map.put("person", new TestBean("Fred"));
map.put("age", 33);
@@ -129,7 +129,7 @@ public class RedirectAttributesModelMapTests {
@Test
public void putAll() {
Map<String, Object> map = new HashMap<String, Object>();
Map<String, Object> map = new HashMap<>();
map.put("person", new TestBean("Fred"));
map.put("age", 33);
this.redirectAttributes.putAll(map);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -84,13 +84,13 @@ public class GzipResourceResolverTests {
VersionResourceResolver versionResolver = new VersionResourceResolver();
versionResolver.setStrategyMap(versionStrategyMap);
List<ResourceResolver> resolvers = new ArrayList<ResourceResolver>();
List<ResourceResolver> resolvers = new ArrayList<>();
resolvers.add(new CachingResourceResolver(this.cache));
resolvers.add(new GzipResourceResolver());
resolvers.add(versionResolver);
resolvers.add(new PathResourceResolver());
resolver = new DefaultResourceResolverChain(resolvers);
locations = new ArrayList<Resource>();
locations = new ArrayList<>();
locations.add(new ClassPathResource("test/", getClass()));
locations.add(new ClassPathResource("testalternatepath/", getClass()));
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -75,10 +75,10 @@ public class AnnotationConfigDispatcherServletInitializerTests {
public void setUp() throws Exception {
servletContext = new MyMockServletContext();
initializer = new MyAnnotationConfigDispatcherServletInitializer();
servlets = new LinkedHashMap<String, Servlet>(1);
servletRegistrations = new LinkedHashMap<String, MockServletRegistration>(1);
filters = new LinkedHashMap<String, Filter>(1);
filterRegistrations = new LinkedHashMap<String, MockFilterRegistration>();
servlets = new LinkedHashMap<>(1);
servletRegistrations = new LinkedHashMap<>(1);
filters = new LinkedHashMap<>(1);
filterRegistrations = new LinkedHashMap<>();
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -180,7 +180,7 @@ public class FlashMapManagerTests {
@Test
public void retrieveAndUpdateRemoveExpired() throws InterruptedException {
List<FlashMap> flashMaps = new ArrayList<FlashMap>();
List<FlashMap> flashMaps = new ArrayList<>();
for (int i = 0; i < 5; i++) {
FlashMap expiredFlashMap = new FlashMap();
expiredFlashMap.startExpirationPeriod(-1);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@ class MockFilterRegistration implements Dynamic {
private boolean asyncSupported = false;
private Map<String, EnumSet<DispatcherType>> mappings = new HashMap<String, EnumSet<DispatcherType>>();
private Map<String, EnumSet<DispatcherType>> mappings = new HashMap<>();
public Map<String, EnumSet<DispatcherType>> getMappings() {

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -29,7 +29,7 @@ class MockServletRegistration implements ServletRegistration.Dynamic {
private int loadOnStartup;
private Set<String> mappings = new LinkedHashSet<String>();
private Set<String> mappings = new LinkedHashSet<>();
private String roleName;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,7 +43,7 @@ public class RequestContextTests {
private MockServletContext servletContext = new MockServletContext();
private Map<String, Object> model = new HashMap<String, Object>();
private Map<String, Object> model = new HashMap<>();
@Before
public void init() {
@@ -63,7 +63,7 @@ public class RequestContextTests {
public void testGetContextUrlWithMap() throws Exception {
request.setContextPath("foo/");
RequestContext context = new RequestContext(request, response, servletContext, model);
Map<String, Object> map = new HashMap<String, Object>();
Map<String, Object> map = new HashMap<>();
map.put("foo", "bar");
map.put("spam", "bucket");
assertEquals("foo/bar?spam=bucket", context.getContextUrl("{foo}?spam={spam}", map));
@@ -73,7 +73,7 @@ public class RequestContextTests {
public void testGetContextUrlWithMapEscaping() throws Exception {
request.setContextPath("foo/");
RequestContext context = new RequestContext(request, response, servletContext, model);
Map<String, Object> map = new HashMap<String, Object>();
Map<String, Object> map = new HashMap<>();
map.put("foo", "bar baz");
map.put("spam", "&bucket=");
assertEquals("foo/bar%20baz?spam=%26bucket%3D", context.getContextUrl("{foo}?spam={spam}", map));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -151,7 +151,7 @@ public class EvalTagTests extends AbstractTagTests {
@Test
public void environmentAccess() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
Map<String, Object> map = new HashMap<>();
map.put("key.foo", "value.foo");
GenericApplicationContext wac = (GenericApplicationContext)
context.getRequest().getAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE);
@@ -205,7 +205,7 @@ public class EvalTagTests extends AbstractTagTests {
}
public Map<String, Object> getMap() {
Map<String, Object> map = new HashMap<String, Object>();
Map<String, Object> map = new HashMap<>();
map.put("key", "value");
return map;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -220,8 +220,8 @@ public class UrlTagTests extends AbstractTagTests {
@Test
public void createQueryStringNoParams() throws JspException {
List<Param> params = new LinkedList<Param>();
Set<String> usedParams = new HashSet<String>();
List<Param> params = new LinkedList<>();
Set<String> usedParams = new HashSet<>();
String queryString = tag.createQueryString(params, usedParams, true);
@@ -230,8 +230,8 @@ public class UrlTagTests extends AbstractTagTests {
@Test
public void createQueryStringOneParam() throws JspException {
List<Param> params = new LinkedList<Param>();
Set<String> usedParams = new HashSet<String>();
List<Param> params = new LinkedList<>();
Set<String> usedParams = new HashSet<>();
Param param = new Param();
param.setName("name");
@@ -246,8 +246,8 @@ public class UrlTagTests extends AbstractTagTests {
@Test
public void createQueryStringOneParamForExsistingQueryString()
throws JspException {
List<Param> params = new LinkedList<Param>();
Set<String> usedParams = new HashSet<String>();
List<Param> params = new LinkedList<>();
Set<String> usedParams = new HashSet<>();
Param param = new Param();
param.setName("name");
@@ -261,8 +261,8 @@ public class UrlTagTests extends AbstractTagTests {
@Test
public void createQueryStringOneParamEmptyValue() throws JspException {
List<Param> params = new LinkedList<Param>();
Set<String> usedParams = new HashSet<String>();
List<Param> params = new LinkedList<>();
Set<String> usedParams = new HashSet<>();
Param param = new Param();
param.setName("name");
@@ -276,8 +276,8 @@ public class UrlTagTests extends AbstractTagTests {
@Test
public void createQueryStringOneParamNullValue() throws JspException {
List<Param> params = new LinkedList<Param>();
Set<String> usedParams = new HashSet<String>();
List<Param> params = new LinkedList<>();
Set<String> usedParams = new HashSet<>();
Param param = new Param();
param.setName("name");
@@ -291,8 +291,8 @@ public class UrlTagTests extends AbstractTagTests {
@Test
public void createQueryStringOneParamAlreadyUsed() throws JspException {
List<Param> params = new LinkedList<Param>();
Set<String> usedParams = new HashSet<String>();
List<Param> params = new LinkedList<>();
Set<String> usedParams = new HashSet<>();
Param param = new Param();
param.setName("name");
@@ -308,8 +308,8 @@ public class UrlTagTests extends AbstractTagTests {
@Test
public void createQueryStringTwoParams() throws JspException {
List<Param> params = new LinkedList<Param>();
Set<String> usedParams = new HashSet<String>();
List<Param> params = new LinkedList<>();
Set<String> usedParams = new HashSet<>();
Param param = new Param();
param.setName("name");
@@ -328,8 +328,8 @@ public class UrlTagTests extends AbstractTagTests {
@Test
public void createQueryStringUrlEncoding() throws JspException {
List<Param> params = new LinkedList<Param>();
Set<String> usedParams = new HashSet<String>();
List<Param> params = new LinkedList<>();
Set<String> usedParams = new HashSet<>();
Param param = new Param();
param.setName("n me");
@@ -348,8 +348,8 @@ public class UrlTagTests extends AbstractTagTests {
@Test
public void createQueryStringParamNullName() throws JspException {
List<Param> params = new LinkedList<Param>();
Set<String> usedParams = new HashSet<String>();
List<Param> params = new LinkedList<>();
Set<String> usedParams = new HashSet<>();
Param param = new Param();
param.setName(null);
@@ -363,8 +363,8 @@ public class UrlTagTests extends AbstractTagTests {
@Test
public void createQueryStringParamEmptyName() throws JspException {
List<Param> params = new LinkedList<Param>();
Set<String> usedParams = new HashSet<String>();
List<Param> params = new LinkedList<>();
Set<String> usedParams = new HashSet<>();
Param param = new Param();
param.setName("");
@@ -378,8 +378,8 @@ public class UrlTagTests extends AbstractTagTests {
@Test
public void replaceUriTemplateParamsNoParams() throws JspException {
List<Param> params = new LinkedList<Param>();
Set<String> usedParams = new HashSet<String>();
List<Param> params = new LinkedList<>();
Set<String> usedParams = new HashSet<>();
String uri = tag.replaceUriTemplateParams("url/path", params,
usedParams);
@@ -391,8 +391,8 @@ public class UrlTagTests extends AbstractTagTests {
@Test
public void replaceUriTemplateParamsTemplateWithoutParamMatch()
throws JspException {
List<Param> params = new LinkedList<Param>();
Set<String> usedParams = new HashSet<String>();
List<Param> params = new LinkedList<>();
Set<String> usedParams = new HashSet<>();
String uri = tag.replaceUriTemplateParams("url/{path}", params,
usedParams);
@@ -404,8 +404,8 @@ public class UrlTagTests extends AbstractTagTests {
@Test
public void replaceUriTemplateParamsTemplateWithParamMatch()
throws JspException {
List<Param> params = new LinkedList<Param>();
Set<String> usedParams = new HashSet<String>();
List<Param> params = new LinkedList<>();
Set<String> usedParams = new HashSet<>();
Param param = new Param();
param.setName("name");
@@ -423,8 +423,8 @@ public class UrlTagTests extends AbstractTagTests {
@Test
public void replaceUriTemplateParamsTemplateWithParamMatchNamePreEncoding()
throws JspException {
List<Param> params = new LinkedList<Param>();
Set<String> usedParams = new HashSet<String>();
List<Param> params = new LinkedList<>();
Set<String> usedParams = new HashSet<>();
Param param = new Param();
param.setName("n me");
@@ -442,8 +442,8 @@ public class UrlTagTests extends AbstractTagTests {
@Test
public void replaceUriTemplateParamsTemplateWithParamMatchValueEncoded()
throws JspException {
List<Param> params = new LinkedList<Param>();
Set<String> usedParams = new HashSet<String>();
List<Param> params = new LinkedList<>();
Set<String> usedParams = new HashSet<>();
Param param = new Param();
param.setName("name");
@@ -463,8 +463,8 @@ public class UrlTagTests extends AbstractTagTests {
@Test
public void replaceUriTemplateParamsTemplateWithPathSegment()
throws JspException {
List<Param> params = new LinkedList<Param>();
Set<String> usedParams = new HashSet<String>();
List<Param> params = new LinkedList<>();
Set<String> usedParams = new HashSet<>();
Param param = new Param();
param.setName("name");
@@ -481,8 +481,8 @@ public class UrlTagTests extends AbstractTagTests {
@Test
public void replaceUriTemplateParamsTemplateWithPath()
throws JspException {
List<Param> params = new LinkedList<Param>();
Set<String> usedParams = new HashSet<String>();
List<Param> params = new LinkedList<>();
Set<String> usedParams = new HashSet<>();
Param param = new Param();
param.setName("name");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -168,7 +168,7 @@ public final class OptionsTagTests extends AbstractHtmlElementTagTests {
getPageContext().setAttribute(
SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, new BindStatus(getRequestContext(), "testBean.myFloat", false));
List<Float> floats = new ArrayList<Float>();
List<Float> floats = new ArrayList<>();
floats.add(new Float("12.30"));
floats.add(new Float("12.31"));
floats.add(new Float("12.32"));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -973,7 +973,7 @@ public class SelectTagTests extends AbstractFormTagTests {
}
private Map getSexes() {
Map<String, String> sexes = new HashMap<String, String>();
Map<String, String> sexes = new HashMap<>();
sexes.put("F", "Female");
sexes.put("M", "Male");
return sexes;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -61,7 +61,7 @@ public class BaseViewTests {
tv.setApplicationContext(wac);
tv.setApplicationContext(wac);
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("foo", "bar");
model.put("something", new Object());
tv.render(model, request, response);
@@ -89,8 +89,8 @@ public class BaseViewTests {
p.setProperty("something", "else");
tv.setAttributes(p);
Map<String, Object> model = new HashMap<String, Object>();
model.put("one", new HashMap<Object, Object>());
Map<String, Object> model = new HashMap<>();
model.put("one", new HashMap<>());
model.put("two", new Object());
tv.render(model, request, response);
@@ -116,12 +116,12 @@ public class BaseViewTests {
p.setProperty("something", "else");
tv.setAttributes(p);
Map<String, Object> pathVars = new HashMap<String, Object>();
pathVars.put("one", new HashMap<Object, Object>());
Map<String, Object> pathVars = new HashMap<>();
pathVars.put("one", new HashMap<>());
pathVars.put("two", new Object());
request.setAttribute(View.PATH_VARIABLES, pathVars);
tv.render(new HashMap<String, Object>(), request, response);
tv.render(new HashMap<>(), request, response);
checkContainsAll(pathVars, tv.model);
@@ -145,8 +145,8 @@ public class BaseViewTests {
p.setProperty("something", "else");
tv.setAttributes(p);
Map<String, Object> model = new HashMap<String, Object>();
model.put("one", new HashMap<Object, Object>());
Map<String, Object> model = new HashMap<>();
model.put("one", new HashMap<>());
model.put("two", new Object());
tv.render(model, request, response);
@@ -169,13 +169,13 @@ public class BaseViewTests {
MockHttpServletRequest request = new MockHttpServletRequest();
MockHttpServletResponse response = new MockHttpServletResponse();
Map<String, Object> pathVars = new HashMap<String, Object>();
Map<String, Object> pathVars = new HashMap<>();
pathVars.put("one", "bar");
pathVars.put("something", "else");
request.setAttribute(View.PATH_VARIABLES, pathVars);
Map<String, Object> model = new HashMap<String, Object>();
model.put("one", new HashMap<Object, Object>());
Map<String, Object> model = new HashMap<>();
model.put("one", new HashMap<>());
model.put("two", new Object());
tv.render(model, request, response);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -281,7 +281,7 @@ public class ContentNegotiatingViewResolverTests {
View viewMock2 = mock(View.class, "text_html");
View viewMock3 = mock(View.class, "application_json");
List<View> defaultViews = new ArrayList<View>();
List<View> defaultViews = new ArrayList<>();
defaultViews.add(viewMock3);
viewResolver.setDefaultViews(defaultViews);
@@ -343,7 +343,7 @@ public class ContentNegotiatingViewResolverTests {
View viewMock2 = mock(View.class, "text_html");
View viewMock3 = mock(View.class, "application_json");
List<View> defaultViews = new ArrayList<View>();
List<View> defaultViews = new ArrayList<>();
defaultViews.add(viewMock3);
viewResolver.setDefaultViews(defaultViews);
@@ -470,7 +470,7 @@ public class ContentNegotiatingViewResolverTests {
InternalResourceViewResolver nestedResolver = new InternalResourceViewResolver();
nestedResolver.setApplicationContext(webAppContext);
nestedResolver.setViewClass(InternalResourceView.class);
viewResolver.setViewResolvers(new ArrayList<ViewResolver>(Arrays.asList(nestedResolver)));
viewResolver.setViewResolvers(new ArrayList<>(Arrays.asList(nestedResolver)));
FixedContentNegotiationStrategy fixedStrategy = new FixedContentNegotiationStrategy(MediaType.TEXT_HTML);
viewResolver.setContentNegotiationManager(new ContentNegotiationManager(fixedStrategy));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,7 +48,7 @@ public class RedirectViewUriTemplateTests {
@Test
public void uriTemplate() throws Exception {
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("foo", "bar");
String baseUrl = "http://url.somewhere.com";
@@ -60,7 +60,7 @@ public class RedirectViewUriTemplateTests {
@Test
public void uriTemplateEncode() throws Exception {
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("foo", "bar/bar baz");
String baseUrl = "http://url.somewhere.com";
@@ -72,7 +72,7 @@ public class RedirectViewUriTemplateTests {
@Test
public void uriTemplateAndArrayQueryParam() throws Exception {
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("foo", "bar");
model.put("fooArr", new String[] { "baz", "bazz" });
@@ -84,7 +84,7 @@ public class RedirectViewUriTemplateTests {
@Test
public void uriTemplateWithObjectConversion() throws Exception {
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("foo", new Long(611));
RedirectView redirectView = new RedirectView("/foo/{foo}");
@@ -95,12 +95,12 @@ public class RedirectViewUriTemplateTests {
@Test
public void uriTemplateReuseCurrentRequestVars() throws Exception {
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("key1", "value1");
model.put("name", "value2");
model.put("key3", "value3");
Map<String, String> currentRequestUriTemplateVars = new HashMap<String, String>();
Map<String, String> currentRequestUriTemplateVars = new HashMap<>();
currentRequestUriTemplateVars.put("var1", "v1");
currentRequestUriTemplateVars.put("name", "v2");
currentRequestUriTemplateVars.put("var3", "v3");
@@ -120,7 +120,7 @@ public class RedirectViewUriTemplateTests {
@Test
public void emptyRedirectString() throws Exception {
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
RedirectView redirectView = new RedirectView("");
redirectView.renderMergedOutputModel(model, this.request, this.response);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -62,7 +62,7 @@ public class XlsViewTests {
}
};
excelView.render(new HashMap<String, Object>(), request, response);
excelView.render(new HashMap<>(), request, response);
Workbook wb = new HSSFWorkbook(new ByteArrayInputStream(response.getContentAsByteArray()));
assertEquals("Test Sheet", wb.getSheetName(0));
@@ -85,7 +85,7 @@ public class XlsViewTests {
}
};
excelView.render(new HashMap<String, Object>(), request, response);
excelView.render(new HashMap<>(), request, response);
Workbook wb = new XSSFWorkbook(new ByteArrayInputStream(response.getContentAsByteArray()));
assertEquals("Test Sheet", wb.getSheetName(0));
@@ -108,7 +108,7 @@ public class XlsViewTests {
}
};
excelView.render(new HashMap<String, Object>(), request, response);
excelView.render(new HashMap<>(), request, response);
Workbook wb = new XSSFWorkbook(new ByteArrayInputStream(response.getContentAsByteArray()));
assertEquals("Test Sheet", wb.getSheetName(0));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -55,7 +55,7 @@ public class AtomFeedViewTests {
MockHttpServletRequest request = new MockHttpServletRequest();
MockHttpServletResponse response = new MockHttpServletResponse();
Map<String, String> model = new LinkedHashMap<String, String>();
Map<String, String> model = new LinkedHashMap<>();
model.put("2", "This is entry 2");
model.put("1", "This is entry 1");
@@ -78,7 +78,7 @@ public class AtomFeedViewTests {
@Override
protected List<Entry> buildFeedEntries(Map model, HttpServletRequest request, HttpServletResponse response)
throws Exception {
List<Entry> entries = new ArrayList<Entry>();
List<Entry> entries = new ArrayList<>();
for (Iterator iterator = model.keySet().iterator(); iterator.hasNext();) {
String name = (String) iterator.next();
Entry entry = new Entry();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -54,7 +54,7 @@ public class RssFeedViewTests {
MockHttpServletRequest request = new MockHttpServletRequest();
MockHttpServletResponse response = new MockHttpServletResponse();
Map<String, String> model = new LinkedHashMap<String, String>();
Map<String, String> model = new LinkedHashMap<>();
model.put("2", "This is entry 2");
model.put("1", "This is entry 1");
@@ -79,7 +79,7 @@ public class RssFeedViewTests {
@Override
protected List<Item> buildFeedItems(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception {
List<Item> items = new ArrayList<Item>();
List<Item> items = new ArrayList<>();
for (String name : model.keySet()) {
Item item = new Item();
item.setTitle(name);

View File

@@ -107,7 +107,7 @@ public class FreeMarkerMacroTests {
fv.setApplicationContext(wac);
fv.setExposeSpringMacroHelpers(true);
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("tb", new TestBean("juergen", 99));
fv.render(model, request, response);
}
@@ -126,7 +126,7 @@ public class FreeMarkerMacroTests {
fv.setApplicationContext(wac);
fv.setExposeSpringMacroHelpers(true);
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put(FreeMarkerView.SPRING_MACRO_REQUEST_CONTEXT_ATTRIBUTE, helperTool);
try {
@@ -283,11 +283,11 @@ public class FreeMarkerMacroTests {
FileCopyUtils.copy("<#import \"spring.ftl\" as spring />\n" + macro, new FileWriter(resource.getPath()));
DummyMacroRequestContext rc = new DummyMacroRequestContext(request);
Map<String, String> msgMap = new HashMap<String, String>();
Map<String, String> msgMap = new HashMap<>();
msgMap.put("hello", "Howdy");
msgMap.put("world", "Mundo");
rc.setMessageMap(msgMap);
Map<String, String> themeMsgMap = new HashMap<String, String>();
Map<String, String> themeMsgMap = new HashMap<>();
themeMsgMap.put("hello", "Howdy!");
themeMsgMap.put("world", "Mundo!");
rc.setThemeMessageMap(themeMsgMap);
@@ -301,14 +301,14 @@ public class FreeMarkerMacroTests {
darren.setStringArray(new String[] {"John", "Fred"});
request.setAttribute("command", darren);
Map<String, String> names = new HashMap<String, String>();
Map<String, String> names = new HashMap<>();
names.put("Darren", "Darren Davison");
names.put("John", "John Doe");
names.put("Fred", "Fred Bloggs");
names.put("Rob&Harrop", "Rob Harrop");
Configuration config = fc.getConfiguration();
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("command", darren);
model.put("springMacroRequestContext", rc);
model.put("msgArgs", new Object[] { "World" });

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -66,7 +66,7 @@ public class FreeMarkerViewTests {
FreeMarkerView fv = new FreeMarkerView();
WebApplicationContext wac = mock(WebApplicationContext.class);
given(wac.getBeansOfType(FreeMarkerConfig.class, true, false)).willReturn(new HashMap<String, FreeMarkerConfig>());
given(wac.getBeansOfType(FreeMarkerConfig.class, true, false)).willReturn(new HashMap<>());
given(wac.getServletContext()).willReturn(new MockServletContext());
fv.setUrl("anythingButNull");
@@ -92,7 +92,7 @@ public class FreeMarkerViewTests {
WebApplicationContext wac = mock(WebApplicationContext.class);
MockServletContext sc = new MockServletContext();
Map<String, FreeMarkerConfig> configs = new HashMap<String, FreeMarkerConfig>();
Map<String, FreeMarkerConfig> configs = new HashMap<>();
FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
configurer.setConfiguration(new TestConfiguration());
configs.put("configurer", configurer);
@@ -108,7 +108,7 @@ public class FreeMarkerViewTests {
request.setAttribute(DispatcherServlet.LOCALE_RESOLVER_ATTRIBUTE, new AcceptHeaderLocaleResolver());
HttpServletResponse response = new MockHttpServletResponse();
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("myattr", "myvalue");
fv.render(model, request, response);
@@ -122,7 +122,7 @@ public class FreeMarkerViewTests {
WebApplicationContext wac = mock(WebApplicationContext.class);
MockServletContext sc = new MockServletContext();
Map<String, FreeMarkerConfig> configs = new HashMap<String, FreeMarkerConfig>();
Map<String, FreeMarkerConfig> configs = new HashMap<>();
FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
configurer.setConfiguration(new TestConfiguration());
configs.put("configurer", configurer);
@@ -139,7 +139,7 @@ public class FreeMarkerViewTests {
HttpServletResponse response = new MockHttpServletResponse();
response.setContentType("myContentType");
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("myattr", "myvalue");
fv.render(model, request, response);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -68,7 +68,7 @@ public class GroovyMarkupViewTests {
public void missingGroovyMarkupConfig() throws Exception {
GroovyMarkupView view = new GroovyMarkupView();
given(this.webAppContext.getBeansOfType(GroovyMarkupConfig.class, true, false))
.willReturn(new HashMap<String, GroovyMarkupConfig>());
.willReturn(new HashMap<>());
view.setUrl("sampleView");
try {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -68,7 +68,7 @@ public abstract class AbstractJasperReportsTests {
protected Map<String, Object> getModel() {
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("ReportTitle", "Dear Lord!");
model.put("dataSource", new JRBeanCollectionDataSource(getData()));
extendModel(model);
@@ -82,7 +82,7 @@ public abstract class AbstractJasperReportsTests {
}
protected List<Object> getData() {
List<Object> list = new ArrayList<Object>();
List<Object> list = new ArrayList<>();
for (int x = 0; x < 10; x++) {
PersonBean bean = new PersonBean();
bean.setId(x);
@@ -94,7 +94,7 @@ public abstract class AbstractJasperReportsTests {
}
protected List<Object> getProductData() {
List<Object> list = new ArrayList<Object>();
List<Object> list = new ArrayList<>();
for (int x = 0; x < 10; x++) {
ProductBean bean = new ProductBean();
bean.setId(x);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -242,7 +242,7 @@ public abstract class AbstractJasperReportsViewTests extends AbstractJasperRepor
String characterEncoding = "UTF-8";
String overiddenCharacterEncoding = "ASCII";
Map<Object, Object> parameters = new HashMap<Object, Object>();
Map<Object, Object> parameters = new HashMap<>();
parameters.put(net.sf.jasperreports.engine.JRExporterParameter.CHARACTER_ENCODING, characterEncoding);
view.setExporterParameters(parameters);
@@ -361,7 +361,7 @@ public abstract class AbstractJasperReportsViewTests extends AbstractJasperRepor
String characterEncoding = "UTF-8";
Map<Object, Object> parameters = new HashMap<Object, Object>();
Map<Object, Object> parameters = new HashMap<>();
parameters.put(net.sf.jasperreports.engine.JRExporterParameter.CHARACTER_ENCODING, characterEncoding);
view.setExporterParameters(parameters);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,7 +40,7 @@ public class ExporterParameterTests extends AbstractJasperReportsTests {
@Test
public void parameterParsing() throws Exception {
Map<String, String> params = new HashMap<String, String>();
Map<String, String> params = new HashMap<>();
params.put("net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IMAGES_URI", "/foo/bar");
AbstractJasperReportsView view = new AbstractJasperReportsView() {
@@ -67,7 +67,7 @@ public class ExporterParameterTests extends AbstractJasperReportsTests {
@Test(expected = IllegalArgumentException.class)
public void invalidClass() throws Exception {
Map<String, String> params = new HashMap<String, String>();
Map<String, String> params = new HashMap<>();
params.put("foo.net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IMAGES_URI", "/foo");
AbstractJasperReportsView view = new JasperReportsHtmlView();
@@ -79,7 +79,7 @@ public class ExporterParameterTests extends AbstractJasperReportsTests {
@Test(expected = IllegalArgumentException.class)
public void invalidField() {
Map<String, String> params = new HashMap<String, String>();
Map<String, String> params = new HashMap<>();
params.put("net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IMAGES_URI_FOO", "/foo");
AbstractJasperReportsView view = new JasperReportsHtmlView();
@@ -91,7 +91,7 @@ public class ExporterParameterTests extends AbstractJasperReportsTests {
@Test(expected = IllegalArgumentException.class)
public void invalidType() {
Map<String, String> params = new HashMap<String, String>();
Map<String, String> params = new HashMap<>();
params.put("java.lang.Boolean.TRUE", "/foo");
AbstractJasperReportsView view = new JasperReportsHtmlView();
@@ -103,7 +103,7 @@ public class ExporterParameterTests extends AbstractJasperReportsTests {
@Test
public void typeConversion() {
Map<String, String> params = new HashMap<String, String>();
Map<String, String> params = new HashMap<>();
params.put("net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN", "true");
AbstractJasperReportsView view = new JasperReportsHtmlView();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -91,10 +91,10 @@ public class JasperReportsMultiFormatViewTests extends AbstractJasperReportsView
JasperReportsMultiFormatView view = (JasperReportsMultiFormatView) getView(UNCOMPILED_REPORT);
Map<String, Class<? extends AbstractJasperReportsView>> mappings =
new HashMap<String, Class<? extends AbstractJasperReportsView>>();
new HashMap<>();
mappings.put("test", ExporterParameterTestView.class);
Map<String, String> exporterParameters = new HashMap<String, String>();
Map<String, String> exporterParameters = new HashMap<>();
// test view class performs the assertions - robh
exporterParameters.put(ExporterParameterTestView.TEST_PARAM, "foo");
@@ -124,7 +124,7 @@ public class JasperReportsMultiFormatViewTests extends AbstractJasperReportsView
}
private Map<String, Object> getBaseModel() {
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("ReportTitle", "Foo");
model.put("dataSource", getData());
return model;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@ public class JasperReportsMultiFormatViewWithCustomMappingsTests extends JasperR
JasperReportsMultiFormatView view = new JasperReportsMultiFormatView();
view.setFormatKey("fmt");
Map<String, Class<? extends AbstractJasperReportsView>> mappings =
new HashMap<String, Class<? extends AbstractJasperReportsView>>();
new HashMap<>();
mappings.put("csv", JasperReportsCsvView.class);
mappings.put("comma-separated", JasperReportsCsvView.class);
mappings.put("html", JasperReportsHtmlView.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -96,7 +96,7 @@ public class MappingJackson2JsonViewTests {
@Test
public void renderSimpleMap() throws Exception {
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("bindingResult", mock(BindingResult.class, "binding_result"));
model.put("foo", "bar");
@@ -116,7 +116,7 @@ public class MappingJackson2JsonViewTests {
@Test
public void renderWithSelectedContentType() throws Exception {
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("foo", "bar");
view.render(model, request, response);
@@ -132,7 +132,7 @@ public class MappingJackson2JsonViewTests {
public void renderCaching() throws Exception {
view.setDisableCaching(false);
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("bindingResult", mock(BindingResult.class, "binding_result"));
model.put("foo", "bar");
@@ -150,7 +150,7 @@ public class MappingJackson2JsonViewTests {
@Test
public void renderSimpleBean() throws Exception {
Object bean = new TestBeanSimple();
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("bindingResult", mock(BindingResult.class, "binding_result"));
model.put("foo", bean);
@@ -193,7 +193,7 @@ public class MappingJackson2JsonViewTests {
@Test
public void renderWithCustomSerializerLocatedByAnnotation() throws Exception {
Object bean = new TestBeanSimpleAnnotated();
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("foo", bean);
view.render(model, request, response);
@@ -212,7 +212,7 @@ public class MappingJackson2JsonViewTests {
view.setObjectMapper(mapper);
Object bean = new TestBeanSimple();
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("foo", bean);
model.put("bar", new TestChildBean());
@@ -228,13 +228,13 @@ public class MappingJackson2JsonViewTests {
@Test
public void renderOnlyIncludedAttributes() throws Exception {
Set<String> attrs = new HashSet<String>();
Set<String> attrs = new HashSet<>();
attrs.add("foo");
attrs.add("baz");
attrs.add("nil");
view.setModelKeys(attrs);
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("foo", "foo");
model.put("bar", "bar");
model.put("baz", "baz");
@@ -283,7 +283,7 @@ public class MappingJackson2JsonViewTests {
@Test
public void renderSimpleBeanWithJsonView() throws Exception {
Object bean = new TestBeanSimple();
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("bindingResult", mock(BindingResult.class, "binding_result"));
model.put("foo", bean);
model.put(JsonView.class.getName(), MyJacksonView1.class);
@@ -304,7 +304,7 @@ public class MappingJackson2JsonViewTests {
TestSimpleBeanFiltered bean = new TestSimpleBeanFiltered();
bean.setProperty1("value");
bean.setProperty2("value");
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("bindingResult", mock(BindingResult.class, "binding_result"));
model.put("foo", bean);
FilterProvider filters = new SimpleFilterProvider().addFilter("myJacksonFilter",
@@ -347,7 +347,7 @@ public class MappingJackson2JsonViewTests {
}
private void testJsonp(String paramName, String paramValue, boolean validValue) throws Exception {
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("foo", "bar");
this.request = new MockHttpServletRequest();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -212,7 +212,7 @@ public class ScriptTemplateViewTests {
MockHttpServletRequest request = new MockHttpServletRequest();
request.setAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE, this.wac);
MockHttpServletResponse response = new MockHttpServletResponse();
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
InvocableScriptEngine engine = mock(InvocableScriptEngine.class);
when(engine.invokeFunction(any(), any(), any(), any())).thenReturn("foo");
this.view.setEngine(engine);
@@ -243,7 +243,7 @@ public class ScriptTemplateViewTests {
MockHttpServletRequest request = new MockHttpServletRequest();
request.setAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE, this.wac);
MockHttpServletResponse response = new MockHttpServletResponse();
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
this.view.setEngine(mock(InvocableScriptEngine.class));
this.view.setRenderFunction("render");
this.view.setResourceLoaderPath("classpath:org/springframework/web/servlet/view/script/");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -75,7 +75,7 @@ public class TilesViewTests {
@Test
public void render() throws Exception {
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("modelAttribute", "modelValue");
view.render(model, request, response);
assertEquals("modelValue", request.getAttribute("modelAttribute"));
@@ -84,14 +84,14 @@ public class TilesViewTests {
@Test
public void alwaysIncludeDefaults() throws Exception {
view.render(new HashMap<String, Object>(), request, response);
view.render(new HashMap<>(), request, response);
assertNull(request.getAttribute(AbstractRequest.FORCE_INCLUDE_ATTRIBUTE_NAME));
}
@Test
public void alwaysIncludeEnabled() throws Exception {
view.setAlwaysInclude(true);
view.render(new HashMap<String, Object>(), request, response);
view.render(new HashMap<>(), request, response);
assertTrue((Boolean)request.getAttribute(AbstractRequest.FORCE_INCLUDE_ATTRIBUTE_NAME));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -83,7 +83,7 @@ public class MappingJackson2XmlViewTests {
@Test
public void renderSimpleMap() throws Exception {
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("bindingResult", mock(BindingResult.class, "binding_result"));
model.put("foo", "bar");
@@ -103,7 +103,7 @@ public class MappingJackson2XmlViewTests {
@Test
public void renderWithSelectedContentType() throws Exception {
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("foo", "bar");
view.render(model, request, response);
@@ -119,7 +119,7 @@ public class MappingJackson2XmlViewTests {
public void renderCaching() throws Exception {
view.setDisableCaching(false);
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("bindingResult", mock(BindingResult.class, "binding_result"));
model.put("foo", "bar");
@@ -131,7 +131,7 @@ public class MappingJackson2XmlViewTests {
@Test
public void renderSimpleBean() throws Exception {
Object bean = new TestBeanSimple();
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("bindingResult", mock(BindingResult.class, "binding_result"));
model.put("foo", bean);
@@ -147,7 +147,7 @@ public class MappingJackson2XmlViewTests {
@Test
public void renderWithCustomSerializerLocatedByAnnotation() throws Exception {
Object bean = new TestBeanSimpleAnnotated();
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("foo", bean);
view.render(model, request, response);
@@ -166,7 +166,7 @@ public class MappingJackson2XmlViewTests {
view.setObjectMapper(mapper);
Object bean = new TestBeanSimple();
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("foo", bean);
view.render(model, request, response);
@@ -182,7 +182,7 @@ public class MappingJackson2XmlViewTests {
public void renderOnlySpecifiedModelKey() throws Exception {
view.setModelKey("bar");
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("foo", "foo");
model.put("bar", "bar");
model.put("baz", "baz");
@@ -201,7 +201,7 @@ public class MappingJackson2XmlViewTests {
@Test(expected = IllegalStateException.class)
public void renderModelWithMultipleKeys() throws Exception {
Map<String, Object> model = new TreeMap<String, Object>();
Map<String, Object> model = new TreeMap<>();
model.put("foo", "foo");
model.put("bar", "bar");
@@ -213,7 +213,7 @@ public class MappingJackson2XmlViewTests {
@Test
public void renderSimpleBeanWithJsonView() throws Exception {
Object bean = new TestBeanSimple();
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put("bindingResult", mock(BindingResult.class, "binding_result"));
model.put("foo", bean);
model.put(JsonView.class.getName(), MyJacksonView1.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -73,7 +73,7 @@ public class MarshallingViewTests {
Object toBeMarshalled = new Object();
String modelKey = "key";
view.setModelKey(modelKey);
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put(modelKey, toBeMarshalled);
MockHttpServletRequest request = new MockHttpServletRequest();
@@ -92,8 +92,8 @@ public class MarshallingViewTests {
String toBeMarshalled = "value";
String modelKey = "key";
view.setModelKey(modelKey);
Map<String, Object> model = new HashMap<String, Object>();
model.put(modelKey, new JAXBElement<String>(new QName("model"), String.class, toBeMarshalled));
Map<String, Object> model = new HashMap<>();
model.put(modelKey, new JAXBElement<>(new QName("model"), String.class, toBeMarshalled));
MockHttpServletRequest request = new MockHttpServletRequest();
MockHttpServletResponse response = new MockHttpServletResponse();
@@ -111,7 +111,7 @@ public class MarshallingViewTests {
Object toBeMarshalled = new Object();
String modelKey = "key";
view.setModelKey("invalidKey");
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put(modelKey, toBeMarshalled);
MockHttpServletRequest request = new MockHttpServletRequest();
@@ -130,7 +130,7 @@ public class MarshallingViewTests {
@Test
public void renderNullModelValue() throws Exception {
String modelKey = "key";
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put(modelKey, null);
MockHttpServletRequest request = new MockHttpServletRequest();
@@ -151,7 +151,7 @@ public class MarshallingViewTests {
Object toBeMarshalled = new Object();
String modelKey = "key";
view.setModelKey(modelKey);
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put(modelKey, toBeMarshalled);
MockHttpServletRequest request = new MockHttpServletRequest();
@@ -172,7 +172,7 @@ public class MarshallingViewTests {
public void renderNoModelKey() throws Exception {
Object toBeMarshalled = new Object();
String modelKey = "key";
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put(modelKey, toBeMarshalled);
MockHttpServletRequest request = new MockHttpServletRequest();
@@ -190,7 +190,7 @@ public class MarshallingViewTests {
public void renderNoModelKeyAndBindingResultFirst() throws Exception {
Object toBeMarshalled = new Object();
String modelKey = "key";
Map<String, Object> model = new LinkedHashMap<String, Object>();
Map<String, Object> model = new LinkedHashMap<>();
model.put(BindingResult.MODEL_KEY_PREFIX + modelKey, new BeanPropertyBindingResult(toBeMarshalled, modelKey));
model.put(modelKey, toBeMarshalled);
@@ -210,7 +210,7 @@ public class MarshallingViewTests {
public void testRenderUnsupportedModel() throws Exception {
Object toBeMarshalled = new Object();
String modelKey = "key";
Map<String, Object> model = new HashMap<String, Object>();
Map<String, Object> model = new HashMap<>();
model.put(modelKey, toBeMarshalled);
MockHttpServletRequest request = new MockHttpServletRequest();