Explicit type can be replaced by <>
Issue: SPR-13188
This commit is contained in:
@@ -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.
|
||||
@@ -46,7 +46,7 @@ public class MockAsyncClientHttpRequest extends MockClientHttpRequest implements
|
||||
|
||||
@Override
|
||||
public ListenableFuture<ClientHttpResponse> executeAsync() throws IOException {
|
||||
SettableListenableFuture<ClientHttpResponse> future = new SettableListenableFuture<ClientHttpResponse>();
|
||||
SettableListenableFuture<ClientHttpResponse> future = new SettableListenableFuture<>();
|
||||
future.set(execute());
|
||||
return future;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -32,7 +32,7 @@ import org.springframework.jndi.JndiTemplate;
|
||||
*/
|
||||
public class ExpectedLookupTemplate extends JndiTemplate {
|
||||
|
||||
private final Map<String, Object> jndiObjects = new ConcurrentHashMap<String, Object>(16);
|
||||
private final Map<String, Object> jndiObjects = new ConcurrentHashMap<>(16);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -58,7 +58,7 @@ public class SimpleNamingContext implements Context {
|
||||
|
||||
private final Hashtable<String, Object> boundObjects;
|
||||
|
||||
private final Hashtable<String, Object> environment = new Hashtable<String, Object>();
|
||||
private final Hashtable<String, Object> environment = new Hashtable<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -73,7 +73,7 @@ public class SimpleNamingContext implements Context {
|
||||
*/
|
||||
public SimpleNamingContext(String root) {
|
||||
this.root = root;
|
||||
this.boundObjects = new Hashtable<String, Object>();
|
||||
this.boundObjects = new Hashtable<>();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -302,7 +302,7 @@ public class SimpleNamingContext implements Context {
|
||||
proot = proot + "/";
|
||||
}
|
||||
String root = context.root + proot;
|
||||
Map<String, T> contents = new HashMap<String, T>();
|
||||
Map<String, T> contents = new HashMap<>();
|
||||
for (String boundName : context.boundObjects.keySet()) {
|
||||
if (boundName.startsWith(root)) {
|
||||
int startIndex = root.length();
|
||||
|
||||
@@ -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.
|
||||
@@ -122,7 +122,7 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
|
||||
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private final Hashtable<String,Object> boundObjects = new Hashtable<String,Object>();
|
||||
private final Hashtable<String,Object> boundObjects = new Hashtable<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -35,7 +35,7 @@ import org.springframework.util.CollectionUtils;
|
||||
*/
|
||||
class HeaderValueHolder {
|
||||
|
||||
private final List<Object> values = new LinkedList<Object>();
|
||||
private final List<Object> values = new LinkedList<>();
|
||||
|
||||
|
||||
public void setValue(Object value) {
|
||||
@@ -60,7 +60,7 @@ class HeaderValueHolder {
|
||||
}
|
||||
|
||||
public List<String> getStringValues() {
|
||||
List<String> stringList = new ArrayList<String>(this.values.size());
|
||||
List<String> stringList = new ArrayList<>(this.values.size());
|
||||
for (Object value : this.values) {
|
||||
stringList.add(value.toString());
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -45,13 +45,13 @@ public class MockAsyncContext implements AsyncContext {
|
||||
|
||||
private final HttpServletResponse response;
|
||||
|
||||
private final List<AsyncListener> listeners = new ArrayList<AsyncListener>();
|
||||
private final List<AsyncListener> listeners = new ArrayList<>();
|
||||
|
||||
private String dispatchedPath;
|
||||
|
||||
private long timeout = 10 * 1000L; // 10 seconds is Tomcat's default
|
||||
|
||||
private final List<Runnable> dispatchHandlers = new ArrayList<Runnable>();
|
||||
private final List<Runnable> dispatchHandlers = new ArrayList<>();
|
||||
|
||||
|
||||
public MockAsyncContext(ServletRequest request, ServletResponse response) {
|
||||
|
||||
@@ -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.
|
||||
@@ -42,7 +42,7 @@ public class MockFilterConfig implements FilterConfig {
|
||||
|
||||
private final String filterName;
|
||||
|
||||
private final Map<String, String> initParameters = new LinkedHashMap<String, String>();
|
||||
private final Map<String, String> initParameters = new LinkedHashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -144,7 +144,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
// ServletRequest properties
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
private final Map<String, Object> attributes = new LinkedHashMap<String, Object>();
|
||||
private final Map<String, Object> attributes = new LinkedHashMap<>();
|
||||
|
||||
private String characterEncoding;
|
||||
|
||||
@@ -152,7 +152,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
|
||||
private String contentType;
|
||||
|
||||
private final Map<String, String[]> parameters = new LinkedHashMap<String, String[]>(16);
|
||||
private final Map<String, String[]> parameters = new LinkedHashMap<>(16);
|
||||
|
||||
private String protocol = DEFAULT_PROTOCOL;
|
||||
|
||||
@@ -167,7 +167,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
private String remoteHost = DEFAULT_REMOTE_HOST;
|
||||
|
||||
/** List of locales in descending order */
|
||||
private final List<Locale> locales = new LinkedList<Locale>();
|
||||
private final List<Locale> locales = new LinkedList<>();
|
||||
|
||||
private boolean secure = false;
|
||||
|
||||
@@ -198,7 +198,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
|
||||
private Cookie[] cookies;
|
||||
|
||||
private final Map<String, HeaderValueHolder> headers = new LinkedCaseInsensitiveMap<HeaderValueHolder>();
|
||||
private final Map<String, HeaderValueHolder> headers = new LinkedCaseInsensitiveMap<>();
|
||||
|
||||
private String method;
|
||||
|
||||
@@ -210,7 +210,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
|
||||
private String remoteUser;
|
||||
|
||||
private final Set<String> userRoles = new HashSet<String>();
|
||||
private final Set<String> userRoles = new HashSet<>();
|
||||
|
||||
private Principal userPrincipal;
|
||||
|
||||
@@ -228,7 +228,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
|
||||
private boolean requestedSessionIdFromURL = false;
|
||||
|
||||
private final MultiValueMap<String, Part> parts = new LinkedMultiValueMap<String, Part>();
|
||||
private final MultiValueMap<String, Part> parts = new LinkedMultiValueMap<>();
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
@@ -347,7 +347,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
@Override
|
||||
public Enumeration<String> getAttributeNames() {
|
||||
checkActive();
|
||||
return Collections.enumeration(new LinkedHashSet<String>(this.attributes.keySet()));
|
||||
return Collections.enumeration(new LinkedHashSet<>(this.attributes.keySet()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -973,7 +973,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
@Override
|
||||
public Enumeration<String> getHeaders(String name) {
|
||||
HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name);
|
||||
return Collections.enumeration(header != null ? header.getStringValues() : new LinkedList<String>());
|
||||
return Collections.enumeration(header != null ? header.getStringValues() : new LinkedList<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1213,7 +1213,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
|
||||
@Override
|
||||
public Collection<Part> getParts() throws IOException, IllegalStateException, ServletException {
|
||||
List<Part> result = new LinkedList<Part>();
|
||||
List<Part> result = new LinkedList<>();
|
||||
for (List<Part> list : this.parts.values()) {
|
||||
result.addAll(list);
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -102,9 +102,9 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
// HttpServletResponse properties
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
private final List<Cookie> cookies = new ArrayList<Cookie>();
|
||||
private final List<Cookie> cookies = new ArrayList<>();
|
||||
|
||||
private final Map<String, HeaderValueHolder> headers = new LinkedCaseInsensitiveMap<HeaderValueHolder>();
|
||||
private final Map<String, HeaderValueHolder> headers = new LinkedCaseInsensitiveMap<>();
|
||||
|
||||
private int status = HttpServletResponse.SC_OK;
|
||||
|
||||
@@ -112,7 +112,7 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
|
||||
private String forwardedUrl;
|
||||
|
||||
private final List<String> includedUrls = new ArrayList<String>();
|
||||
private final List<String> includedUrls = new ArrayList<>();
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@@ -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.
|
||||
@@ -63,7 +63,7 @@ public class MockHttpSession implements HttpSession {
|
||||
|
||||
private final ServletContext servletContext;
|
||||
|
||||
private final Map<String, Object> attributes = new LinkedHashMap<String, Object>();
|
||||
private final Map<String, Object> attributes = new LinkedHashMap<>();
|
||||
|
||||
private boolean invalid = false;
|
||||
|
||||
@@ -166,7 +166,7 @@ public class MockHttpSession implements HttpSession {
|
||||
@Override
|
||||
public Enumeration<String> getAttributeNames() {
|
||||
assertIsValid();
|
||||
return Collections.enumeration(new LinkedHashSet<String>(this.attributes.keySet()));
|
||||
return Collections.enumeration(new LinkedHashSet<>(this.attributes.keySet()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -270,7 +270,7 @@ public class MockHttpSession implements HttpSession {
|
||||
* @return a representation of this session's serialized state
|
||||
*/
|
||||
public Serializable serializeState() {
|
||||
HashMap<String, Serializable> state = new HashMap<String, Serializable>();
|
||||
HashMap<String, Serializable> state = new HashMap<>();
|
||||
for (Iterator<Map.Entry<String, Object>> it = this.attributes.entrySet().iterator(); it.hasNext();) {
|
||||
Map.Entry<String, Object> entry = it.next();
|
||||
String name = entry.getKey();
|
||||
|
||||
@@ -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.
|
||||
@@ -50,7 +50,7 @@ import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
public class MockMultipartHttpServletRequest extends MockHttpServletRequest implements MultipartHttpServletRequest {
|
||||
|
||||
private final MultiValueMap<String, MultipartFile> multipartFiles =
|
||||
new LinkedMultiValueMap<String, MultipartFile>();
|
||||
new LinkedMultiValueMap<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -112,7 +112,7 @@ public class MockMultipartHttpServletRequest extends MockHttpServletRequest impl
|
||||
|
||||
@Override
|
||||
public MultiValueMap<String, MultipartFile> getMultiFileMap() {
|
||||
return new LinkedMultiValueMap<String, MultipartFile>(this.multipartFiles);
|
||||
return new LinkedMultiValueMap<>(this.multipartFiles);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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 MockPageContext extends PageContext {
|
||||
|
||||
private final ServletConfig servletConfig;
|
||||
|
||||
private final Map<String, Object> attributes = new LinkedHashMap<String, Object>();
|
||||
private final Map<String, Object> attributes = new LinkedHashMap<>();
|
||||
|
||||
private JspWriter out;
|
||||
|
||||
@@ -257,7 +257,7 @@ public class MockPageContext extends PageContext {
|
||||
}
|
||||
|
||||
public Enumeration<String> getAttributeNames() {
|
||||
return Collections.enumeration(new LinkedHashSet<String>(this.attributes.keySet()));
|
||||
return Collections.enumeration(new LinkedHashSet<>(this.attributes.keySet()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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.
|
||||
@@ -41,7 +41,7 @@ public class MockServletConfig implements ServletConfig {
|
||||
|
||||
private final String servletName;
|
||||
|
||||
private final Map<String, String> initParameters = new LinkedHashMap<String, String>();
|
||||
private final Map<String, String> initParameters = new LinkedHashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -106,7 +106,7 @@ public class MockServletContext implements ServletContext {
|
||||
private static final String TEMP_DIR_SYSTEM_PROPERTY = "java.io.tmpdir";
|
||||
|
||||
private static final Set<SessionTrackingMode> DEFAULT_SESSION_TRACKING_MODES =
|
||||
new LinkedHashSet<SessionTrackingMode>(3);
|
||||
new LinkedHashSet<>(3);
|
||||
|
||||
static {
|
||||
DEFAULT_SESSION_TRACKING_MODES.add(SessionTrackingMode.COOKIE);
|
||||
@@ -123,7 +123,7 @@ public class MockServletContext implements ServletContext {
|
||||
|
||||
private String contextPath = "";
|
||||
|
||||
private final Map<String, ServletContext> contexts = new HashMap<String, ServletContext>();
|
||||
private final Map<String, ServletContext> contexts = new HashMap<>();
|
||||
|
||||
private int majorVersion = 3;
|
||||
|
||||
@@ -133,17 +133,17 @@ public class MockServletContext implements ServletContext {
|
||||
|
||||
private int effectiveMinorVersion = 0;
|
||||
|
||||
private final Map<String, RequestDispatcher> namedRequestDispatchers = new HashMap<String, RequestDispatcher>();
|
||||
private final Map<String, RequestDispatcher> namedRequestDispatchers = new HashMap<>();
|
||||
|
||||
private String defaultServletName = COMMON_DEFAULT_SERVLET_NAME;
|
||||
|
||||
private final Map<String, String> initParameters = new LinkedHashMap<String, String>();
|
||||
private final Map<String, String> initParameters = new LinkedHashMap<>();
|
||||
|
||||
private final Map<String, Object> attributes = new LinkedHashMap<String, Object>();
|
||||
private final Map<String, Object> attributes = new LinkedHashMap<>();
|
||||
|
||||
private String servletContextName = "MockServletContext";
|
||||
|
||||
private final Set<String> declaredRoles = new LinkedHashSet<String>();
|
||||
private final Set<String> declaredRoles = new LinkedHashSet<>();
|
||||
|
||||
private Set<SessionTrackingMode> sessionTrackingModes;
|
||||
|
||||
@@ -304,7 +304,7 @@ public class MockServletContext implements ServletContext {
|
||||
if (ObjectUtils.isEmpty(fileList)) {
|
||||
return null;
|
||||
}
|
||||
Set<String> resourcePaths = new LinkedHashSet<String>(fileList.length);
|
||||
Set<String> resourcePaths = new LinkedHashSet<>(fileList.length);
|
||||
for (String fileEntry : fileList) {
|
||||
String resultPath = actualPath + fileEntry;
|
||||
if (resource.createRelative(fileEntry).getFile().isDirectory()) {
|
||||
@@ -502,7 +502,7 @@ public class MockServletContext implements ServletContext {
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getAttributeNames() {
|
||||
return Collections.enumeration(new LinkedHashSet<String>(this.attributes.keySet()));
|
||||
return Collections.enumeration(new LinkedHashSet<>(this.attributes.keySet()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -127,7 +127,7 @@ public class MergedContextConfiguration implements Serializable {
|
||||
}
|
||||
|
||||
// Active profiles must be unique
|
||||
Set<String> profilesSet = new LinkedHashSet<String>(Arrays.asList(activeProfiles));
|
||||
Set<String> profilesSet = new LinkedHashSet<>(Arrays.asList(activeProfiles));
|
||||
return StringUtils.toStringArray(profilesSet);
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ public class TestContextManager {
|
||||
|
||||
private final TestContext testContext;
|
||||
|
||||
private final List<TestExecutionListener> testExecutionListeners = new ArrayList<TestExecutionListener>();
|
||||
private final List<TestExecutionListener> testExecutionListeners = new ArrayList<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -165,7 +165,7 @@ public class TestContextManager {
|
||||
* registered for this {@code TestContextManager} in reverse order.
|
||||
*/
|
||||
private List<TestExecutionListener> getReversedTestExecutionListeners() {
|
||||
List<TestExecutionListener> listenersReversed = new ArrayList<TestExecutionListener>(getTestExecutionListeners());
|
||||
List<TestExecutionListener> listenersReversed = new ArrayList<>(getTestExecutionListeners());
|
||||
Collections.reverse(listenersReversed);
|
||||
return listenersReversed;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class DefaultContextCache implements ContextCache {
|
||||
* of other contexts.
|
||||
*/
|
||||
private final Map<MergedContextConfiguration, Set<MergedContextConfiguration>> hierarchyMap =
|
||||
new ConcurrentHashMap<MergedContextConfiguration, Set<MergedContextConfiguration>>(32);
|
||||
new ConcurrentHashMap<>(32);
|
||||
|
||||
private final int maxSize;
|
||||
|
||||
@@ -143,7 +143,7 @@ public class DefaultContextCache implements ContextCache {
|
||||
while (parent != null) {
|
||||
Set<MergedContextConfiguration> list = this.hierarchyMap.get(parent);
|
||||
if (list == null) {
|
||||
list = new HashSet<MergedContextConfiguration>();
|
||||
list = new HashSet<>();
|
||||
this.hierarchyMap.put(parent, list);
|
||||
}
|
||||
list.add(child);
|
||||
@@ -168,7 +168,7 @@ public class DefaultContextCache implements ContextCache {
|
||||
}
|
||||
}
|
||||
|
||||
List<MergedContextConfiguration> removedContexts = new ArrayList<MergedContextConfiguration>();
|
||||
List<MergedContextConfiguration> removedContexts = new ArrayList<>();
|
||||
remove(removedContexts, startKey);
|
||||
|
||||
// Remove all remaining references to any removed contexts from the
|
||||
|
||||
@@ -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.
|
||||
@@ -95,7 +95,7 @@ public class SpringClassRule implements TestRule {
|
||||
* Cache of {@code TestContextManagers} keyed by test class.
|
||||
*/
|
||||
private static final Map<Class<?>, TestContextManager> testContextManagerCache =
|
||||
new ConcurrentHashMap<Class<?>, TestContextManager>(64);
|
||||
new ConcurrentHashMap<>(64);
|
||||
|
||||
static {
|
||||
if (!ClassUtils.isPresent("org.junit.internal.Throwables", SpringClassRule.class.getClassLoader())) {
|
||||
|
||||
@@ -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.
|
||||
@@ -65,7 +65,7 @@ public class RunAfterTestClassCallbacks extends Statement {
|
||||
*/
|
||||
@Override
|
||||
public void evaluate() throws Throwable {
|
||||
List<Throwable> errors = new ArrayList<Throwable>();
|
||||
List<Throwable> errors = new ArrayList<>();
|
||||
try {
|
||||
this.next.evaluate();
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -81,7 +81,7 @@ public class RunAfterTestMethodCallbacks extends Statement {
|
||||
@Override
|
||||
public void evaluate() throws Throwable {
|
||||
Throwable testException = null;
|
||||
List<Throwable> errors = new ArrayList<Throwable>();
|
||||
List<Throwable> errors = new ArrayList<>();
|
||||
try {
|
||||
this.next.evaluate();
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ public abstract class AbstractContextLoader implements SmartContextLoader {
|
||||
return;
|
||||
}
|
||||
|
||||
List<ApplicationContextInitializer<ConfigurableApplicationContext>> initializerInstances = new ArrayList<ApplicationContextInitializer<ConfigurableApplicationContext>>();
|
||||
List<ApplicationContextInitializer<ConfigurableApplicationContext>> initializerInstances = new ArrayList<>();
|
||||
Class<?> contextClass = context.getClass();
|
||||
|
||||
for (Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>> initializerClass : initializerClasses) {
|
||||
|
||||
@@ -120,7 +120,7 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
|
||||
public final List<TestExecutionListener> getTestExecutionListeners() {
|
||||
Class<?> clazz = getBootstrapContext().getTestClass();
|
||||
Class<TestExecutionListeners> annotationType = TestExecutionListeners.class;
|
||||
List<Class<? extends TestExecutionListener>> classesList = new ArrayList<Class<? extends TestExecutionListener>>();
|
||||
List<Class<? extends TestExecutionListener>> classesList = new ArrayList<>();
|
||||
boolean usingDefaults = false;
|
||||
|
||||
AnnotationDescriptor<TestExecutionListeners> descriptor =
|
||||
@@ -170,7 +170,7 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
|
||||
|
||||
// Remove possible duplicates if we loaded default listeners.
|
||||
if (usingDefaults) {
|
||||
Set<Class<? extends TestExecutionListener>> classesSet = new HashSet<Class<? extends TestExecutionListener>>();
|
||||
Set<Class<? extends TestExecutionListener>> classesSet = new HashSet<>();
|
||||
classesSet.addAll(classesList);
|
||||
classesList.clear();
|
||||
classesList.addAll(classesSet);
|
||||
@@ -190,7 +190,7 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
|
||||
}
|
||||
|
||||
private List<TestExecutionListener> instantiateListeners(List<Class<? extends TestExecutionListener>> classesList) {
|
||||
List<TestExecutionListener> listeners = new ArrayList<TestExecutionListener>(classesList.size());
|
||||
List<TestExecutionListener> listeners = new ArrayList<>(classesList.size());
|
||||
for (Class<? extends TestExecutionListener> listenerClass : classesList) {
|
||||
NoClassDefFoundError ncdfe = null;
|
||||
try {
|
||||
@@ -226,7 +226,7 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Set<Class<? extends TestExecutionListener>> getDefaultTestExecutionListenerClasses() {
|
||||
Set<Class<? extends TestExecutionListener>> defaultListenerClasses = new LinkedHashSet<Class<? extends TestExecutionListener>>();
|
||||
Set<Class<? extends TestExecutionListener>> defaultListenerClasses = new LinkedHashSet<>();
|
||||
ClassLoader cl = getClass().getClassLoader();
|
||||
for (String className : getDefaultTestExecutionListenerClassNames()) {
|
||||
try {
|
||||
@@ -284,7 +284,7 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
|
||||
MergedContextConfiguration mergedConfig = null;
|
||||
|
||||
for (List<ContextConfigurationAttributes> list : hierarchyMap.values()) {
|
||||
List<ContextConfigurationAttributes> reversedList = new ArrayList<ContextConfigurationAttributes>(list);
|
||||
List<ContextConfigurationAttributes> reversedList = new ArrayList<>(list);
|
||||
Collections.reverse(reversedList);
|
||||
|
||||
// Don't use the supplied testClass; instead ensure that we are
|
||||
@@ -357,9 +357,9 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
|
||||
Assert.notEmpty(configAttributesList, "ContextConfigurationAttributes list must not be null or empty");
|
||||
|
||||
ContextLoader contextLoader = resolveContextLoader(testClass, configAttributesList);
|
||||
List<String> locations = new ArrayList<String>();
|
||||
List<Class<?>> classes = new ArrayList<Class<?>>();
|
||||
List<Class<?>> initializers = new ArrayList<Class<?>>();
|
||||
List<String> locations = new ArrayList<>();
|
||||
List<Class<?>> classes = new ArrayList<>();
|
||||
List<Class<?>> initializers = new ArrayList<>();
|
||||
|
||||
for (ContextConfigurationAttributes configAttributes : configAttributesList) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
@@ -413,7 +413,7 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
|
||||
List<ContextConfigurationAttributes> configAttributes) {
|
||||
|
||||
List<ContextCustomizerFactory> factories = getContextCustomizerFactories();
|
||||
Set<ContextCustomizer> customizers = new LinkedHashSet<ContextCustomizer>(factories.size());
|
||||
Set<ContextCustomizer> customizers = new LinkedHashSet<>(factories.size());
|
||||
for (ContextCustomizerFactory factory : factories) {
|
||||
ContextCustomizer customizer = factory.createContextCustomizer(testClass, configAttributes);
|
||||
if (customizer != null) {
|
||||
|
||||
@@ -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 @@ abstract class ActiveProfilesUtils {
|
||||
static String[] resolveActiveProfiles(Class<?> testClass) {
|
||||
Assert.notNull(testClass, "Class must not be null");
|
||||
|
||||
final List<String[]> profileArrays = new ArrayList<String[]>();
|
||||
final List<String[]> profileArrays = new ArrayList<>();
|
||||
|
||||
Class<ActiveProfiles> annotationType = ActiveProfiles.class;
|
||||
AnnotationDescriptor<ActiveProfiles> descriptor = MetaAnnotationUtils.findAnnotationDescriptor(testClass,
|
||||
@@ -130,7 +130,7 @@ abstract class ActiveProfilesUtils {
|
||||
// Reverse the list so that we can traverse "down" the hierarchy.
|
||||
Collections.reverse(profileArrays);
|
||||
|
||||
final Set<String> activeProfiles = new LinkedHashSet<String>();
|
||||
final Set<String> activeProfiles = new LinkedHashSet<>();
|
||||
for (String[] profiles : profileArrays) {
|
||||
for (String profile : profiles) {
|
||||
if (StringUtils.hasText(profile)) {
|
||||
|
||||
@@ -60,7 +60,7 @@ public abstract class AnnotationConfigContextLoaderUtils {
|
||||
public static Class<?>[] detectDefaultConfigurationClasses(Class<?> declaringClass) {
|
||||
Assert.notNull(declaringClass, "Declaring class must not be null");
|
||||
|
||||
List<Class<?>> configClasses = new ArrayList<Class<?>>();
|
||||
List<Class<?>> configClasses = new ArrayList<>();
|
||||
|
||||
for (Class<?> candidate : declaringClass.getDeclaredClasses()) {
|
||||
if (isDefaultConfigurationClassCandidate(candidate)) {
|
||||
|
||||
@@ -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.
|
||||
@@ -74,7 +74,7 @@ abstract class ApplicationContextInitializerUtils {
|
||||
Assert.notEmpty(configAttributesList, "ContextConfigurationAttributes list must not be empty");
|
||||
|
||||
final Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses = //
|
||||
new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>();
|
||||
new HashSet<>();
|
||||
|
||||
for (ContextConfigurationAttributes configAttributes : configAttributesList) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
|
||||
@@ -97,7 +97,7 @@ abstract class ContextLoaderUtils {
|
||||
|
||||
Class<ContextConfiguration> contextConfigType = ContextConfiguration.class;
|
||||
Class<ContextHierarchy> contextHierarchyType = ContextHierarchy.class;
|
||||
List<List<ContextConfigurationAttributes>> hierarchyAttributes = new ArrayList<List<ContextConfigurationAttributes>>();
|
||||
List<List<ContextConfigurationAttributes>> hierarchyAttributes = new ArrayList<>();
|
||||
|
||||
UntypedAnnotationDescriptor desc =
|
||||
findAnnotationDescriptorForTypes(testClass, contextConfigType, contextHierarchyType);
|
||||
@@ -122,7 +122,7 @@ abstract class ContextLoaderUtils {
|
||||
throw new IllegalStateException(msg);
|
||||
}
|
||||
|
||||
List<ContextConfigurationAttributes> configAttributesList = new ArrayList<ContextConfigurationAttributes>();
|
||||
List<ContextConfigurationAttributes> configAttributesList = new ArrayList<>();
|
||||
|
||||
if (contextConfigDeclaredLocally) {
|
||||
ContextConfiguration contextConfiguration = AnnotationUtils.synthesizeAnnotation(
|
||||
@@ -178,7 +178,7 @@ abstract class ContextLoaderUtils {
|
||||
* @see #resolveContextHierarchyAttributes(Class)
|
||||
*/
|
||||
static Map<String, List<ContextConfigurationAttributes>> buildContextHierarchyMap(Class<?> testClass) {
|
||||
final Map<String, List<ContextConfigurationAttributes>> map = new LinkedHashMap<String, List<ContextConfigurationAttributes>>();
|
||||
final Map<String, List<ContextConfigurationAttributes>> map = new LinkedHashMap<>();
|
||||
int hierarchyLevel = 1;
|
||||
|
||||
for (List<ContextConfigurationAttributes> configAttributesList : resolveContextHierarchyAttributes(testClass)) {
|
||||
@@ -193,7 +193,7 @@ abstract class ContextLoaderUtils {
|
||||
// Encountered a new context hierarchy level?
|
||||
if (!map.containsKey(name)) {
|
||||
hierarchyLevel++;
|
||||
map.put(name, new ArrayList<ContextConfigurationAttributes>());
|
||||
map.put(name, new ArrayList<>());
|
||||
}
|
||||
|
||||
map.get(name).add(configAttributes);
|
||||
@@ -201,7 +201,7 @@ abstract class ContextLoaderUtils {
|
||||
}
|
||||
|
||||
// Check for uniqueness
|
||||
Set<List<ContextConfigurationAttributes>> set = new HashSet<List<ContextConfigurationAttributes>>(map.values());
|
||||
Set<List<ContextConfigurationAttributes>> set = new HashSet<>(map.values());
|
||||
if (set.size() != map.size()) {
|
||||
String msg = String.format("The @ContextConfiguration elements configured via @ContextHierarchy in " +
|
||||
"test class [%s] and its superclasses must define unique contexts per hierarchy level.",
|
||||
@@ -233,7 +233,7 @@ abstract class ContextLoaderUtils {
|
||||
static List<ContextConfigurationAttributes> resolveContextConfigurationAttributes(Class<?> testClass) {
|
||||
Assert.notNull(testClass, "Class must not be null");
|
||||
|
||||
List<ContextConfigurationAttributes> attributesList = new ArrayList<ContextConfigurationAttributes>();
|
||||
List<ContextConfigurationAttributes> attributesList = new ArrayList<>();
|
||||
Class<ContextConfiguration> annotationType = ContextConfiguration.class;
|
||||
|
||||
AnnotationDescriptor<ContextConfiguration> descriptor = findAnnotationDescriptor(testClass, annotationType);
|
||||
|
||||
@@ -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.
|
||||
@@ -59,7 +59,7 @@ public class DefaultActiveProfilesResolver implements ActiveProfilesResolver {
|
||||
public String[] resolve(Class<?> testClass) {
|
||||
Assert.notNull(testClass, "Class must not be null");
|
||||
|
||||
final Set<String> activeProfiles = new LinkedHashSet<String>();
|
||||
final Set<String> activeProfiles = new LinkedHashSet<>();
|
||||
|
||||
Class<ActiveProfiles> annotationType = ActiveProfiles.class;
|
||||
AnnotationDescriptor<ActiveProfiles> descriptor = findAnnotationDescriptor(testClass, annotationType);
|
||||
|
||||
@@ -85,7 +85,7 @@ public abstract class TestPropertySourceUtils {
|
||||
private static List<TestPropertySourceAttributes> resolveTestPropertySourceAttributes(Class<?> testClass) {
|
||||
Assert.notNull(testClass, "Class must not be null");
|
||||
|
||||
final List<TestPropertySourceAttributes> attributesList = new ArrayList<TestPropertySourceAttributes>();
|
||||
final List<TestPropertySourceAttributes> attributesList = new ArrayList<>();
|
||||
final Class<TestPropertySource> annotationType = TestPropertySource.class;
|
||||
AnnotationDescriptor<TestPropertySource> descriptor = findAnnotationDescriptor(testClass, annotationType);
|
||||
Assert.notNull(descriptor, String.format(
|
||||
@@ -115,7 +115,7 @@ public abstract class TestPropertySourceUtils {
|
||||
}
|
||||
|
||||
private static String[] mergeLocations(List<TestPropertySourceAttributes> attributesList) {
|
||||
final List<String> locations = new ArrayList<String>();
|
||||
final List<String> locations = new ArrayList<>();
|
||||
|
||||
for (TestPropertySourceAttributes attrs : attributesList) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
@@ -135,7 +135,7 @@ public abstract class TestPropertySourceUtils {
|
||||
}
|
||||
|
||||
private static String[] mergeProperties(List<TestPropertySourceAttributes> attributesList) {
|
||||
final List<String> properties = new ArrayList<String>();
|
||||
final List<String> properties = new ArrayList<>();
|
||||
|
||||
for (TestPropertySourceAttributes attrs : attributesList) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
@@ -255,7 +255,7 @@ public abstract class TestPropertySourceUtils {
|
||||
}
|
||||
MapPropertySource ps = (MapPropertySource) environment.getPropertySources().get(INLINED_PROPERTIES_PROPERTY_SOURCE_NAME);
|
||||
if (ps == null) {
|
||||
ps = new MapPropertySource(INLINED_PROPERTIES_PROPERTY_SOURCE_NAME, new LinkedHashMap<String, Object>());
|
||||
ps = new MapPropertySource(INLINED_PROPERTIES_PROPERTY_SOURCE_NAME, new LinkedHashMap<>());
|
||||
environment.getPropertySources().addFirst(ps);
|
||||
}
|
||||
ps.getSource().putAll(convertInlinedPropertiesToMap(inlinedProperties));
|
||||
@@ -281,7 +281,7 @@ public abstract class TestPropertySourceUtils {
|
||||
*/
|
||||
public static Map<String, Object> convertInlinedPropertiesToMap(String... inlinedProperties) {
|
||||
Assert.notNull(inlinedProperties, "inlinedProperties must not be null");
|
||||
Map<String, Object> map = new LinkedHashMap<String, Object>();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
Properties props = new Properties();
|
||||
|
||||
for (String pair : inlinedProperties) {
|
||||
|
||||
@@ -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.
|
||||
@@ -26,8 +26,8 @@ import org.springframework.core.NamedInheritableThreadLocal;
|
||||
*/
|
||||
class TransactionContextHolder {
|
||||
|
||||
private static final ThreadLocal<TransactionContext> currentTransactionContext = new NamedInheritableThreadLocal<TransactionContext>(
|
||||
"Test Transaction Context");
|
||||
private static final ThreadLocal<TransactionContext> currentTransactionContext = new NamedInheritableThreadLocal<>(
|
||||
"Test Transaction Context");
|
||||
|
||||
|
||||
static TransactionContext getCurrentTransactionContext() {
|
||||
|
||||
@@ -442,7 +442,7 @@ public class TransactionalTestExecutionListener extends AbstractTestExecutionLis
|
||||
* as well as annotated interface default methods
|
||||
*/
|
||||
private List<Method> getAnnotatedMethods(Class<?> clazz, Class<? extends Annotation> annotationType) {
|
||||
List<Method> methods = new ArrayList<Method>(4);
|
||||
List<Method> methods = new ArrayList<>(4);
|
||||
for (Method method : ReflectionUtils.getUniqueDeclaredMethods(clazz)) {
|
||||
if (AnnotationUtils.getAnnotation(method, annotationType) != null) {
|
||||
methods.add(method);
|
||||
|
||||
@@ -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.
|
||||
@@ -114,7 +114,7 @@ public abstract class TestContextResourceUtils {
|
||||
* @see #convertToClasspathResourcePaths
|
||||
*/
|
||||
public static List<Resource> convertToResourceList(ResourceLoader resourceLoader, String... paths) {
|
||||
List<Resource> list = new ArrayList<Resource>();
|
||||
List<Resource> list = new ArrayList<>();
|
||||
for (String path : paths) {
|
||||
list.add(resourceLoader.getResource(path));
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public abstract class MetaAnnotationUtils {
|
||||
public static <T extends Annotation> AnnotationDescriptor<T> findAnnotationDescriptor(
|
||||
Class<?> clazz, Class<T> annotationType) {
|
||||
|
||||
return findAnnotationDescriptor(clazz, new HashSet<Annotation>(), annotationType);
|
||||
return findAnnotationDescriptor(clazz, new HashSet<>(), annotationType);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,7 +106,7 @@ public abstract class MetaAnnotationUtils {
|
||||
|
||||
// Declared locally?
|
||||
if (AnnotationUtils.isAnnotationDeclaredLocally(annotationType, clazz)) {
|
||||
return new AnnotationDescriptor<T>(clazz, clazz.getAnnotation(annotationType));
|
||||
return new AnnotationDescriptor<>(clazz, clazz.getAnnotation(annotationType));
|
||||
}
|
||||
|
||||
// Declared on a composed annotation (i.e., as a meta-annotation)?
|
||||
@@ -115,7 +115,7 @@ public abstract class MetaAnnotationUtils {
|
||||
AnnotationDescriptor<T> descriptor = findAnnotationDescriptor(
|
||||
composedAnnotation.annotationType(), visited, annotationType);
|
||||
if (descriptor != null) {
|
||||
return new AnnotationDescriptor<T>(
|
||||
return new AnnotationDescriptor<>(
|
||||
clazz, descriptor.getDeclaringClass(), composedAnnotation, descriptor.getAnnotation());
|
||||
}
|
||||
}
|
||||
@@ -125,8 +125,8 @@ public abstract class MetaAnnotationUtils {
|
||||
for (Class<?> ifc : clazz.getInterfaces()) {
|
||||
AnnotationDescriptor<T> descriptor = findAnnotationDescriptor(ifc, visited, annotationType);
|
||||
if (descriptor != null) {
|
||||
return new AnnotationDescriptor<T>(clazz, descriptor.getDeclaringClass(),
|
||||
descriptor.getComposedAnnotation(), descriptor.getAnnotation());
|
||||
return new AnnotationDescriptor<>(clazz, descriptor.getDeclaringClass(),
|
||||
descriptor.getComposedAnnotation(), descriptor.getAnnotation());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ public abstract class MetaAnnotationUtils {
|
||||
public static UntypedAnnotationDescriptor findAnnotationDescriptorForTypes(
|
||||
Class<?> clazz, Class<? extends Annotation>... annotationTypes) {
|
||||
|
||||
return findAnnotationDescriptorForTypes(clazz, new HashSet<Annotation>(), annotationTypes);
|
||||
return findAnnotationDescriptorForTypes(clazz, new HashSet<>(), annotationTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -200,7 +200,7 @@ public abstract class ModelAndViewAssert {
|
||||
private static void appendNonMatchingSetsErrorMessage(Set<String> assertionSet, Set<String> incorrectSet,
|
||||
StringBuilder sb) {
|
||||
|
||||
Set<String> tempSet = new HashSet<String>();
|
||||
Set<String> tempSet = new HashSet<>();
|
||||
tempSet.addAll(incorrectSet);
|
||||
tempSet.removeAll(assertionSet);
|
||||
|
||||
@@ -213,7 +213,7 @@ public abstract class ModelAndViewAssert {
|
||||
}
|
||||
}
|
||||
|
||||
tempSet = new HashSet<String>();
|
||||
tempSet = new HashSet<>();
|
||||
tempSet.addAll(assertionSet);
|
||||
tempSet.removeAll(incorrectSet);
|
||||
|
||||
|
||||
@@ -42,9 +42,9 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public abstract class AbstractRequestExpectationManager implements RequestExpectationManager {
|
||||
|
||||
private final List<RequestExpectation> expectations = new LinkedList<RequestExpectation>();
|
||||
private final List<RequestExpectation> expectations = new LinkedList<>();
|
||||
|
||||
private final List<ClientHttpRequest> requests = new LinkedList<ClientHttpRequest>();
|
||||
private final List<ClientHttpRequest> requests = new LinkedList<>();
|
||||
|
||||
|
||||
protected List<RequestExpectation> getExpectations() {
|
||||
@@ -147,7 +147,7 @@ public abstract class AbstractRequestExpectationManager implements RequestExpect
|
||||
*/
|
||||
protected static class RequestExpectationGroup {
|
||||
|
||||
private final Set<RequestExpectation> expectations = new LinkedHashSet<RequestExpectation>();
|
||||
private final Set<RequestExpectation> expectations = new LinkedHashSet<>();
|
||||
|
||||
public Set<RequestExpectation> getExpectations() {
|
||||
return this.expectations;
|
||||
|
||||
@@ -35,7 +35,7 @@ public class DefaultRequestExpectation implements RequestExpectation {
|
||||
|
||||
private final RequestCount requestCount;
|
||||
|
||||
private final List<RequestMatcher> requestMatchers = new LinkedList<RequestMatcher>();
|
||||
private final List<RequestMatcher> requestMatchers = new LinkedList<>();
|
||||
|
||||
private ResponseCreator responseCreator;
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ class DefaultMvcResult implements MvcResult {
|
||||
|
||||
private Exception resolvedException;
|
||||
|
||||
private final AtomicReference<Object> asyncResult = new AtomicReference<Object>(RESULT_NONE);
|
||||
private final AtomicReference<Object> asyncResult = new AtomicReference<>(RESULT_NONE);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -70,9 +70,9 @@ public final class MockMvc {
|
||||
|
||||
private RequestBuilder defaultRequestBuilder;
|
||||
|
||||
private List<ResultMatcher> defaultResultMatchers = new ArrayList<ResultMatcher>();
|
||||
private List<ResultMatcher> defaultResultMatchers = new ArrayList<>();
|
||||
|
||||
private List<ResultHandler> defaultResultHandlers = new ArrayList<ResultHandler>();
|
||||
private List<ResultHandler> defaultResultHandlers = new ArrayList<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -56,7 +56,7 @@ import com.gargoylesoftware.htmlunit.WebRequest;
|
||||
*/
|
||||
public final class HostRequestMatcher implements WebRequestMatcher {
|
||||
|
||||
private final Set<String> hosts = new HashSet<String>();
|
||||
private final Set<String> hosts = new HashSet<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -253,7 +253,7 @@ final class HtmlUnitRequestBuilder implements RequestBuilder, Mergeable {
|
||||
}
|
||||
|
||||
private void cookies(MockHttpServletRequest request) {
|
||||
List<Cookie> cookies = new ArrayList<Cookie>();
|
||||
List<Cookie> cookies = new ArrayList<>();
|
||||
|
||||
String cookieHeaderValue = header("Cookie");
|
||||
if (cookieHeaderValue != null) {
|
||||
|
||||
@@ -57,7 +57,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public final class MockMvcWebConnection implements WebConnection {
|
||||
|
||||
private final Map<String, MockHttpSession> sessions = new HashMap<String, MockHttpSession>();
|
||||
private final Map<String, MockHttpSession> sessions = new HashMap<>();
|
||||
|
||||
private final MockMvc mockMvc;
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public abstract class MockMvcWebConnectionBuilderSupport<T extends MockMvcWebCon
|
||||
|
||||
private final MockMvc mockMvc;
|
||||
|
||||
private final List<WebRequestMatcher> requestMatchers = new ArrayList<WebRequestMatcher>();
|
||||
private final List<WebRequestMatcher> requestMatchers = new ArrayList<>();
|
||||
|
||||
private String contextPath = "";
|
||||
|
||||
@@ -159,7 +159,7 @@ public abstract class MockMvcWebConnectionBuilderSupport<T extends MockMvcWebCon
|
||||
if (this.alwaysUseMockMvc) {
|
||||
return connection;
|
||||
}
|
||||
List<DelegateWebConnection> delegates = new ArrayList<DelegateWebConnection>(this.requestMatchers.size());
|
||||
List<DelegateWebConnection> delegates = new ArrayList<>(this.requestMatchers.size());
|
||||
for (WebRequestMatcher matcher : this.requestMatchers) {
|
||||
delegates.add(new DelegateWebConnection(matcher, connection));
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ final class MockWebResponseBuilder {
|
||||
|
||||
private List<NameValuePair> responseHeaders() {
|
||||
Collection<String> headerNames = this.response.getHeaderNames();
|
||||
List<NameValuePair> responseHeaders = new ArrayList<NameValuePair>(headerNames.size());
|
||||
List<NameValuePair> responseHeaders = new ArrayList<>(headerNames.size());
|
||||
for (String headerName : headerNames) {
|
||||
List<Object> headerValues = this.response.getHeaderValues(headerName);
|
||||
for (Object value : headerValues) {
|
||||
|
||||
@@ -82,15 +82,15 @@ public class MockHttpServletRequestBuilder
|
||||
|
||||
private final URI url;
|
||||
|
||||
private final MultiValueMap<String, Object> headers = new LinkedMultiValueMap<String, Object>();
|
||||
private final MultiValueMap<String, Object> headers = new LinkedMultiValueMap<>();
|
||||
|
||||
private String contentType;
|
||||
|
||||
private byte[] content;
|
||||
|
||||
private final MultiValueMap<String, String> parameters = new LinkedMultiValueMap<String, String>();
|
||||
private final MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
|
||||
|
||||
private final List<Cookie> cookies = new ArrayList<Cookie>();
|
||||
private final List<Cookie> cookies = new ArrayList<>();
|
||||
|
||||
private Locale locale;
|
||||
|
||||
@@ -100,13 +100,13 @@ public class MockHttpServletRequestBuilder
|
||||
|
||||
private Principal principal;
|
||||
|
||||
private final Map<String, Object> attributes = new LinkedHashMap<String, Object>();
|
||||
private final Map<String, Object> attributes = new LinkedHashMap<>();
|
||||
|
||||
private MockHttpSession session;
|
||||
|
||||
private final Map<String, Object> sessionAttributes = new LinkedHashMap<String, Object>();
|
||||
private final Map<String, Object> sessionAttributes = new LinkedHashMap<>();
|
||||
|
||||
private final Map<String, Object> flashAttributes = new LinkedHashMap<String, Object>();
|
||||
private final Map<String, Object> flashAttributes = new LinkedHashMap<>();
|
||||
|
||||
private String contextPath = "";
|
||||
|
||||
@@ -114,7 +114,7 @@ public class MockHttpServletRequestBuilder
|
||||
|
||||
private String pathInfo = ValueConstants.DEFAULT_NONE;
|
||||
|
||||
private final List<RequestPostProcessor> postProcessors = new ArrayList<RequestPostProcessor>();
|
||||
private final List<RequestPostProcessor> postProcessors = new ArrayList<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -250,7 +250,7 @@ public class MockHttpServletRequestBuilder
|
||||
*/
|
||||
public MockHttpServletRequestBuilder accept(String... mediaTypes) {
|
||||
Assert.notEmpty(mediaTypes, "No 'Accept' media types");
|
||||
List<MediaType> result = new ArrayList<MediaType>(mediaTypes.length);
|
||||
List<MediaType> result = new ArrayList<>(mediaTypes.length);
|
||||
for (String mediaType : mediaTypes) {
|
||||
result.add(MediaType.parseMediaType(mediaType));
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -36,7 +36,7 @@ import org.springframework.mock.web.MockMultipartHttpServletRequest;
|
||||
*/
|
||||
public class MockMultipartHttpServletRequestBuilder extends MockHttpServletRequestBuilder {
|
||||
|
||||
private final List<MockMultipartFile> files = new ArrayList<MockMultipartFile>();
|
||||
private final List<MockMultipartFile> files = new ArrayList<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -124,7 +124,7 @@ public class PrintingResultHandler implements ResultHandler {
|
||||
|
||||
protected final MultiValueMap<String, String> getParamsMultiValueMap(MockHttpServletRequest request) {
|
||||
Map<String, String[]> params = request.getParameterMap();
|
||||
MultiValueMap<String, String> multiValueMap = new LinkedMultiValueMap<String, String>();
|
||||
MultiValueMap<String, String> multiValueMap = new LinkedMultiValueMap<>();
|
||||
for (String name : params.keySet()) {
|
||||
if (params.get(name) != null) {
|
||||
for (String value : params.get(name)) {
|
||||
|
||||
@@ -47,17 +47,17 @@ import org.springframework.web.context.WebApplicationContext;
|
||||
public abstract class AbstractMockMvcBuilder<B extends AbstractMockMvcBuilder<B>>
|
||||
extends MockMvcBuilderSupport implements ConfigurableMockMvcBuilder<B> {
|
||||
|
||||
private List<Filter> filters = new ArrayList<Filter>();
|
||||
private List<Filter> filters = new ArrayList<>();
|
||||
|
||||
private RequestBuilder defaultRequestBuilder;
|
||||
|
||||
private final List<ResultMatcher> globalResultMatchers = new ArrayList<ResultMatcher>();
|
||||
private final List<ResultMatcher> globalResultMatchers = new ArrayList<>();
|
||||
|
||||
private final List<ResultHandler> globalResultHandlers = new ArrayList<ResultHandler>();
|
||||
private final List<ResultHandler> globalResultHandlers = new ArrayList<>();
|
||||
|
||||
private Boolean dispatchOptions = Boolean.TRUE;
|
||||
|
||||
private final List<MockMvcConfigurer> configurers = new ArrayList<MockMvcConfigurer>(4);
|
||||
private final List<MockMvcConfigurer> configurers = new ArrayList<>(4);
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -49,13 +49,13 @@ final class PatternMappingFilterProxy implements Filter {
|
||||
private final Filter delegate;
|
||||
|
||||
/** Patterns that require an exact match, e.g. "/test" */
|
||||
private final List<String> exactMatches = new ArrayList<String>();
|
||||
private final List<String> exactMatches = new ArrayList<>();
|
||||
|
||||
/** Patterns that require the URL to have a specific prefix, e.g. "/test/*" */
|
||||
private final List<String> startsWithMatches = new ArrayList<String>();
|
||||
private final List<String> startsWithMatches = new ArrayList<>();
|
||||
|
||||
/** Patterns that require the request URL to have a specific suffix, e.g. "*.html" */
|
||||
private final List<String> endsWithMatches = new ArrayList<String>();
|
||||
private final List<String> endsWithMatches = new ArrayList<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -89,13 +89,13 @@ public class StandaloneMockMvcBuilder extends AbstractMockMvcBuilder<StandaloneM
|
||||
|
||||
private List<Object> controllerAdvice;
|
||||
|
||||
private List<HttpMessageConverter<?>> messageConverters = new ArrayList<HttpMessageConverter<?>>();
|
||||
private List<HttpMessageConverter<?>> messageConverters = new ArrayList<>();
|
||||
|
||||
private List<HandlerMethodArgumentResolver> customArgumentResolvers = new ArrayList<HandlerMethodArgumentResolver>();
|
||||
private List<HandlerMethodArgumentResolver> customArgumentResolvers = new ArrayList<>();
|
||||
|
||||
private List<HandlerMethodReturnValueHandler> customReturnValueHandlers = new ArrayList<HandlerMethodReturnValueHandler>();
|
||||
private List<HandlerMethodReturnValueHandler> customReturnValueHandlers = new ArrayList<>();
|
||||
|
||||
private final List<MappedInterceptor> mappedInterceptors = new ArrayList<MappedInterceptor>();
|
||||
private final List<MappedInterceptor> mappedInterceptors = new ArrayList<>();
|
||||
|
||||
private Validator validator = null;
|
||||
|
||||
@@ -119,7 +119,7 @@ public class StandaloneMockMvcBuilder extends AbstractMockMvcBuilder<StandaloneM
|
||||
|
||||
private Boolean removeSemicolonContent;
|
||||
|
||||
private Map<String, String> placeHolderValues = new HashMap<String, String>();
|
||||
private Map<String, String> placeHolderValues = new HashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user