Browse Source

Polishing

(cherry picked from commit e9d24d5)
pull/718/head
Juergen Hoeller 11 years ago
parent
commit
62a6c3733d
  1. 4
      spring-context/src/main/java/org/springframework/context/annotation/AnnotationBeanNameGenerator.java
  2. 5
      spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassEnhancer.java
  3. 2
      spring-context/src/main/java/org/springframework/context/event/AbstractApplicationEventMulticaster.java
  4. 33
      spring-context/src/main/java/org/springframework/jmx/access/MBeanClientInterceptor.java
  5. 14
      spring-context/src/main/java/org/springframework/jmx/support/JmxUtils.java
  6. 21
      spring-core/src/main/java/org/springframework/core/BridgeMethodResolver.java
  7. 9
      spring-web/src/main/java/org/springframework/http/client/ClientHttpRequest.java
  8. 11
      spring-web/src/main/java/org/springframework/http/client/ClientHttpResponse.java
  9. 6
      spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerMacroTests.java
  10. 27
      spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerViewTests.java

4
spring-context/src/main/java/org/springframework/context/annotation/AnnotationBeanNameGenerator.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@ -139,7 +139,7 @@ public class AnnotationBeanNameGenerator implements BeanNameGenerator { @@ -139,7 +139,7 @@ public class AnnotationBeanNameGenerator implements BeanNameGenerator {
* <p>The default implementation simply builds a decapitalized version
* of the short class name: e.g. "mypackage.MyJdbcDao" -> "myJdbcDao".
* <p>Note that inner classes will thus have names of the form
* "outerClassName.innerClassName", which because of the period in the
* "outerClassName.InnerClassName", which because of the period in the
* name may be an issue if you are autowiring by name.
* @param definition the bean definition to build a bean name for
* @return the default bean name (never {@code null})

5
spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassEnhancer.java

@ -240,9 +240,8 @@ class ConfigurationClassEnhancer { @@ -240,9 +240,8 @@ class ConfigurationClassEnhancer {
/**
* Enhance a {@link Bean @Bean} method to check the supplied BeanFactory for the
* existence of this bean object.
* @throws Throwable as a catch-all for any exception that may be thrown when
* invoking the super implementation of the proxied method i.e., the actual
* {@code @Bean} method.
* @throws Throwable as a catch-all for any exception that may be thrown when invoking the
* super implementation of the proxied method i.e., the actual {@code @Bean} method
*/
public Object intercept(Object enhancedConfigInstance, Method beanMethod, Object[] beanMethodArgs,
MethodProxy cglibMethodProxy) throws Throwable {

2
spring-context/src/main/java/org/springframework/context/event/AbstractApplicationEventMulticaster.java

@ -227,7 +227,7 @@ public abstract class AbstractApplicationEventMulticaster @@ -227,7 +227,7 @@ public abstract class AbstractApplicationEventMulticaster
* for the given event type
*/
protected boolean supportsEvent(
ApplicationListener listener, Class<? extends ApplicationEvent> eventType, Class sourceType) {
ApplicationListener listener, Class<? extends ApplicationEvent> eventType, Class<?> sourceType) {
SmartApplicationListener smartListener = (listener instanceof SmartApplicationListener ?
(SmartApplicationListener) listener : new GenericApplicationListenerAdapter(listener));

33
spring-context/src/main/java/org/springframework/jmx/access/MBeanClientInterceptor.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 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.
@ -107,7 +107,7 @@ public class MBeanClientInterceptor @@ -107,7 +107,7 @@ public class MBeanClientInterceptor
private boolean useStrictCasing = true;
private Class managementInterface;
private Class<?> managementInterface;
private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
@ -215,7 +215,7 @@ public class MBeanClientInterceptor @@ -215,7 +215,7 @@ public class MBeanClientInterceptor
* setters and getters for MBean attributes and conventional Java methods
* for MBean operations.
*/
public void setManagementInterface(Class managementInterface) {
public void setManagementInterface(Class<?> managementInterface) {
this.managementInterface = managementInterface;
}
@ -223,7 +223,7 @@ public class MBeanClientInterceptor @@ -223,7 +223,7 @@ public class MBeanClientInterceptor
* Return the management interface of the target MBean,
* or {@code null} if none specified.
*/
protected final Class getManagementInterface() {
protected final Class<?> getManagementInterface() {
return this.managementInterface;
}
@ -262,7 +262,7 @@ public class MBeanClientInterceptor @@ -262,7 +262,7 @@ public class MBeanClientInterceptor
this.invocationHandler = null;
if (this.useStrictCasing) {
// Use the JDK's own MBeanServerInvocationHandler,
// in particular for native MXBean support on Java 6.
// in particular for native MXBean support on Java 6+.
if (JmxUtils.isMXBeanSupportAvailable()) {
this.invocationHandler =
new MBeanServerInvocationHandler(this.serverToUse, this.objectName,
@ -297,7 +297,7 @@ public class MBeanClientInterceptor @@ -297,7 +297,7 @@ public class MBeanClientInterceptor
MBeanOperationInfo[] operationInfo = info.getOperations();
this.allowedOperations = new HashMap<MethodCacheKey, MBeanOperationInfo>(operationInfo.length);
for (MBeanOperationInfo infoEle : operationInfo) {
Class[] paramTypes = JmxUtils.parameterInfoToTypes(infoEle.getSignature(), this.beanClassLoader);
Class<?>[] paramTypes = JmxUtils.parameterInfoToTypes(infoEle.getSignature(), this.beanClassLoader);
this.allowedOperations.put(new MethodCacheKey(infoEle.getName(), paramTypes), infoEle);
}
}
@ -531,7 +531,7 @@ public class MBeanClientInterceptor @@ -531,7 +531,7 @@ public class MBeanClientInterceptor
* is necessary
*/
protected Object convertResultValueIfNecessary(Object result, MethodParameter parameter) {
Class targetClass = parameter.getParameterType();
Class<?> targetClass = parameter.getParameterType();
try {
if (result == null) {
return null;
@ -549,7 +549,7 @@ public class MBeanClientInterceptor @@ -549,7 +549,7 @@ public class MBeanClientInterceptor
return convertDataArrayToTargetArray(array, targetClass);
}
else if (Collection.class.isAssignableFrom(targetClass)) {
Class elementType = GenericCollectionTypeResolver.getCollectionParameterType(parameter);
Class<?> elementType = GenericCollectionTypeResolver.getCollectionParameterType(parameter);
if (elementType != null) {
return convertDataArrayToTargetCollection(array, targetClass, elementType);
}
@ -565,7 +565,7 @@ public class MBeanClientInterceptor @@ -565,7 +565,7 @@ public class MBeanClientInterceptor
return convertDataArrayToTargetArray(array, targetClass);
}
else if (Collection.class.isAssignableFrom(targetClass)) {
Class elementType = GenericCollectionTypeResolver.getCollectionParameterType(parameter);
Class<?> elementType = GenericCollectionTypeResolver.getCollectionParameterType(parameter);
if (elementType != null) {
return convertDataArrayToTargetCollection(array, targetClass, elementType);
}
@ -581,8 +581,8 @@ public class MBeanClientInterceptor @@ -581,8 +581,8 @@ public class MBeanClientInterceptor
}
}
private Object convertDataArrayToTargetArray(Object[] array, Class targetClass) throws NoSuchMethodException {
Class targetType = targetClass.getComponentType();
private Object convertDataArrayToTargetArray(Object[] array, Class<?> targetClass) throws NoSuchMethodException {
Class<?> targetType = targetClass.getComponentType();
Method fromMethod = targetType.getMethod("from", array.getClass().getComponentType());
Object resultArray = Array.newInstance(targetType, array.length);
for (int i = 0; i < array.length; i++) {
@ -592,11 +592,11 @@ public class MBeanClientInterceptor @@ -592,11 +592,11 @@ public class MBeanClientInterceptor
}
@SuppressWarnings("unchecked")
private Collection convertDataArrayToTargetCollection(Object[] array, Class collectionType, Class elementType)
private Collection<?> convertDataArrayToTargetCollection(Object[] array, Class<?> collectionType, Class<?> elementType)
throws NoSuchMethodException {
Method fromMethod = elementType.getMethod("from", array.getClass().getComponentType());
Collection resultColl = CollectionFactory.createCollection(collectionType, Array.getLength(array));
Collection<Object> resultColl = CollectionFactory.createCollection(collectionType, Array.getLength(array));
for (int i = 0; i < array.length; i++) {
resultColl.add(ReflectionUtils.invokeMethod(fromMethod, null, array[i]));
}
@ -608,6 +608,7 @@ public class MBeanClientInterceptor @@ -608,6 +608,7 @@ public class MBeanClientInterceptor
this.connector.close();
}
/**
* Simple wrapper class around a method name and its signature.
* Used as the key when caching methods.
@ -616,7 +617,7 @@ public class MBeanClientInterceptor @@ -616,7 +617,7 @@ public class MBeanClientInterceptor
private final String name;
private final Class[] parameterTypes;
private final Class<?>[] parameterTypes;
/**
* Create a new instance of {@code MethodCacheKey} with the supplied
@ -624,9 +625,9 @@ public class MBeanClientInterceptor @@ -624,9 +625,9 @@ public class MBeanClientInterceptor
* @param name the name of the method
* @param parameterTypes the arguments in the method signature
*/
public MethodCacheKey(String name, Class[] parameterTypes) {
public MethodCacheKey(String name, Class<?>[] parameterTypes) {
this.name = name;
this.parameterTypes = (parameterTypes != null ? parameterTypes : new Class[0]);
this.parameterTypes = (parameterTypes != null ? parameterTypes : new Class<?>[0]);
}
@Override

14
spring-context/src/main/java/org/springframework/jmx/support/JmxUtils.java

@ -145,7 +145,7 @@ public abstract class JmxUtils { @@ -145,7 +145,7 @@ public abstract class JmxUtils {
* @return the parameter types as classes
* @throws ClassNotFoundException if a parameter type could not be resolved
*/
public static Class[] parameterInfoToTypes(MBeanParameterInfo[] paramInfo) throws ClassNotFoundException {
public static Class<?>[] parameterInfoToTypes(MBeanParameterInfo[] paramInfo) throws ClassNotFoundException {
return parameterInfoToTypes(paramInfo, ClassUtils.getDefaultClassLoader());
}
@ -157,12 +157,12 @@ public abstract class JmxUtils { @@ -157,12 +157,12 @@ public abstract class JmxUtils {
* @return the parameter types as classes
* @throws ClassNotFoundException if a parameter type could not be resolved
*/
public static Class[] parameterInfoToTypes(MBeanParameterInfo[] paramInfo, ClassLoader classLoader)
public static Class<?>[] parameterInfoToTypes(MBeanParameterInfo[] paramInfo, ClassLoader classLoader)
throws ClassNotFoundException {
Class[] types = null;
Class<?>[] types = null;
if (paramInfo != null && paramInfo.length > 0) {
types = new Class[paramInfo.length];
types = new Class<?>[paramInfo.length];
for (int x = 0; x < paramInfo.length; x++) {
types[x] = ClassUtils.forName(paramInfo[x].getType(), classLoader);
}
@ -178,7 +178,7 @@ public abstract class JmxUtils { @@ -178,7 +178,7 @@ public abstract class JmxUtils {
* @return the signature as array of argument types
*/
public static String[] getMethodSignature(Method method) {
Class[] types = method.getParameterTypes();
Class<?>[] types = method.getParameterTypes();
String[] signature = new String[types.length];
for (int x = 0; x < types.length; x++) {
signature[x] = types[x].getName();
@ -282,7 +282,7 @@ public abstract class JmxUtils { @@ -282,7 +282,7 @@ public abstract class JmxUtils {
return null;
}
String mbeanInterfaceName = clazz.getName() + MBEAN_SUFFIX;
Class[] implementedInterfaces = clazz.getInterfaces();
Class<?>[] implementedInterfaces = clazz.getInterfaces();
for (Class<?> iface : implementedInterfaces) {
if (iface.getName().equals(mbeanInterfaceName)) {
return iface;
@ -302,7 +302,7 @@ public abstract class JmxUtils { @@ -302,7 +302,7 @@ public abstract class JmxUtils {
if (clazz == null || clazz.getSuperclass() == null) {
return null;
}
Class[] implementedInterfaces = clazz.getInterfaces();
Class<?>[] implementedInterfaces = clazz.getInterfaces();
for (Class<?> iface : implementedInterfaces) {
boolean isMxBean = iface.getName().endsWith(MXBEAN_SUFFIX);
if (mxBeanAnnotationAvailable) {

21
spring-core/src/main/java/org/springframework/core/BridgeMethodResolver.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@ -143,7 +143,7 @@ public abstract class BridgeMethodResolver { @@ -143,7 +143,7 @@ public abstract class BridgeMethodResolver {
*/
private static Method findGenericDeclaration(Method bridgeMethod) {
// Search parent types for method that has same signature as bridge.
Class superclass = bridgeMethod.getDeclaringClass().getSuperclass();
Class<?> superclass = bridgeMethod.getDeclaringClass().getSuperclass();
while (superclass != null && !Object.class.equals(superclass)) {
Method method = searchForMatch(superclass, bridgeMethod);
if (method != null && !method.isBridge()) {
@ -153,8 +153,8 @@ public abstract class BridgeMethodResolver { @@ -153,8 +153,8 @@ public abstract class BridgeMethodResolver {
}
// Search interfaces.
Class[] interfaces = ClassUtils.getAllInterfacesForClass(bridgeMethod.getDeclaringClass());
for (Class ifc : interfaces) {
Class<?>[] interfaces = ClassUtils.getAllInterfacesForClass(bridgeMethod.getDeclaringClass());
for (Class<?> ifc : interfaces) {
Method method = searchForMatch(ifc, bridgeMethod);
if (method != null && !method.isBridge()) {
return method;
@ -174,13 +174,13 @@ public abstract class BridgeMethodResolver { @@ -174,13 +174,13 @@ public abstract class BridgeMethodResolver {
Method genericMethod, Method candidateMethod, Map<TypeVariable, Type> typeVariableMap) {
Type[] genericParameters = genericMethod.getGenericParameterTypes();
Class[] candidateParameters = candidateMethod.getParameterTypes();
Class<?>[] candidateParameters = candidateMethod.getParameterTypes();
if (genericParameters.length != candidateParameters.length) {
return false;
}
for (int i = 0; i < genericParameters.length; i++) {
Type genericParameter = genericParameters[i];
Class candidateParameter = candidateParameters[i];
Class<?> candidateParameter = candidateParameters[i];
if (candidateParameter.isArray()) {
// An array type: compare the component type.
Type rawType = GenericTypeResolver.getRawType(genericParameter, typeVariableMap);
@ -193,7 +193,7 @@ public abstract class BridgeMethodResolver { @@ -193,7 +193,7 @@ public abstract class BridgeMethodResolver {
}
}
// A non-array type: compare the type itself.
Class resolvedParameter = GenericTypeResolver.resolveType(genericParameter, typeVariableMap);
Class<?> resolvedParameter = GenericTypeResolver.resolveType(genericParameter, typeVariableMap);
if (!candidateParameter.equals(resolvedParameter)) {
return false;
}
@ -206,7 +206,7 @@ public abstract class BridgeMethodResolver { @@ -206,7 +206,7 @@ public abstract class BridgeMethodResolver {
* that of the supplied {@link Method}, then this matching {@link Method} is returned,
* otherwise {@code null} is returned.
*/
private static Method searchForMatch(Class type, Method bridgeMethod) {
private static Method searchForMatch(Class<?> type, Method bridgeMethod) {
return ReflectionUtils.findMethod(type, bridgeMethod.getName(), bridgeMethod.getParameterTypes());
}
@ -221,9 +221,8 @@ public abstract class BridgeMethodResolver { @@ -221,9 +221,8 @@ public abstract class BridgeMethodResolver {
if (bridgeMethod == bridgedMethod) {
return true;
}
return Arrays.equals(bridgeMethod.getParameterTypes(), bridgedMethod.getParameterTypes()) &&
bridgeMethod.getReturnType().equals(bridgedMethod.getReturnType());
return (Arrays.equals(bridgeMethod.getParameterTypes(), bridgedMethod.getParameterTypes()) &&
bridgeMethod.getReturnType().equals(bridgedMethod.getReturnType()));
}
}

9
spring-web/src/main/java/org/springframework/http/client/ClientHttpRequest.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 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.
@ -23,10 +23,11 @@ import org.springframework.http.HttpOutputMessage; @@ -23,10 +23,11 @@ import org.springframework.http.HttpOutputMessage;
import org.springframework.http.HttpRequest;
/**
* Represents a client-side HTTP request. Created via an implementation of the {@link ClientHttpRequestFactory}.
* Represents a client-side HTTP request.
* Created via an implementation of the {@link ClientHttpRequestFactory}.
*
* <p>A {@code HttpRequest} can be {@linkplain #execute() executed}, getting a {@link ClientHttpResponse}
* which can be read from.
* <p>A {@code ClientHttpRequest} can be {@linkplain #execute() executed},
* receiving a {@link ClientHttpResponse} which can be read from.
*
* @author Arjen Poutsma
* @since 3.0

11
spring-web/src/main/java/org/springframework/http/client/ClientHttpResponse.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 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.
@ -23,10 +23,11 @@ import org.springframework.http.HttpInputMessage; @@ -23,10 +23,11 @@ import org.springframework.http.HttpInputMessage;
import org.springframework.http.HttpStatus;
/**
* Represents a client-side HTTP response. Obtained via an calling of the {@link ClientHttpRequest#execute()}.
* Represents a client-side HTTP response.
* Obtained via an calling of the {@link ClientHttpRequest#execute()}.
*
* <p>A {@code ClientHttpResponse} must be {@linkplain #close() closed}, typically in a
* {@code finally} block.
* <p>A {@code ClientHttpResponse} must be {@linkplain #close() closed},
* typically in a {@code finally} block.
*
* @author Arjen Poutsma
* @since 3.0
@ -55,7 +56,7 @@ public interface ClientHttpResponse extends HttpInputMessage, Closeable { @@ -55,7 +56,7 @@ public interface ClientHttpResponse extends HttpInputMessage, Closeable {
String getStatusText() throws IOException;
/**
* Closes this response, freeing any resources created.
* Close this response, freeing any resources created.
*/
void close();

6
spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerMacroTests.java

@ -73,7 +73,7 @@ public class FreeMarkerMacroTests { @@ -73,7 +73,7 @@ public class FreeMarkerMacroTests {
// final Template expectedTemplate = new Template();
fc = new FreeMarkerConfigurer();
fc.setTemplateLoaderPaths(new String[] { "classpath:/", "file://" + System.getProperty("java.io.tmpdir") });
fc.setTemplateLoaderPaths("classpath:/", "file://" + System.getProperty("java.io.tmpdir"));
fc.afterPropertiesSet();
wac.getDefaultListableBeanFactory().registerSingleton("freeMarkerConfigurer", fc);
@ -86,6 +86,7 @@ public class FreeMarkerMacroTests { @@ -86,6 +86,7 @@ public class FreeMarkerMacroTests {
response = new MockHttpServletResponse();
}
@Test
public void testExposeSpringMacroHelpers() throws Exception {
FreeMarkerView fv = new FreeMarkerView() {
@ -128,7 +129,8 @@ public class FreeMarkerMacroTests { @@ -128,7 +129,8 @@ public class FreeMarkerMacroTests {
try {
fv.render(model, request, response);
} catch (Exception ex) {
}
catch (Exception ex) {
assertTrue(ex instanceof ServletException);
assertTrue(ex.getMessage().contains(FreeMarkerView.SPRING_MACRO_REQUEST_CONTEXT_ATTRIBUTE));
}

27
spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerViewTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@ -23,10 +23,14 @@ import java.io.Writer; @@ -23,10 +23,14 @@ import java.io.Writer;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import freemarker.ext.servlet.AllHttpScopesHashModel;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import org.junit.Test;
import org.springframework.context.ApplicationContextException;
import org.springframework.mock.web.test.MockHttpServletRequest;
import org.springframework.mock.web.test.MockHttpServletResponse;
@ -40,11 +44,6 @@ import org.springframework.web.servlet.view.AbstractView; @@ -40,11 +44,6 @@ import org.springframework.web.servlet.view.AbstractView;
import org.springframework.web.servlet.view.InternalResourceView;
import org.springframework.web.servlet.view.RedirectView;
import freemarker.ext.servlet.AllHttpScopesHashModel;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import static org.junit.Assert.*;
import static org.mockito.BDDMockito.*;
@ -70,7 +69,7 @@ public class FreeMarkerViewTests { @@ -70,7 +69,7 @@ public class FreeMarkerViewTests {
}
catch (ApplicationContextException ex) {
// Check there's a helpful error message
assertTrue(ex.getMessage().indexOf("FreeMarkerConfig") != -1);
assertTrue(ex.getMessage().contains("FreeMarkerConfig"));
}
}
@ -83,7 +82,7 @@ public class FreeMarkerViewTests { @@ -83,7 +82,7 @@ public class FreeMarkerViewTests {
}
catch (IllegalArgumentException ex) {
// Check there's a helpful error message
assertTrue(ex.getMessage().indexOf("url") != -1);
assertTrue(ex.getMessage().contains("url"));
}
}
@ -94,7 +93,7 @@ public class FreeMarkerViewTests { @@ -94,7 +93,7 @@ public class FreeMarkerViewTests {
WebApplicationContext wac = mock(WebApplicationContext.class);
MockServletContext sc = new MockServletContext();
Map configs = new HashMap();
Map<String, FreeMarkerConfig> configs = new HashMap<String, FreeMarkerConfig>();
FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
configurer.setConfiguration(new TestConfiguration());
configs.put("configurer", configurer);
@ -110,7 +109,7 @@ public class FreeMarkerViewTests { @@ -110,7 +109,7 @@ public class FreeMarkerViewTests {
request.setAttribute(DispatcherServlet.LOCALE_RESOLVER_ATTRIBUTE, new AcceptHeaderLocaleResolver());
HttpServletResponse response = new MockHttpServletResponse();
Map model = new HashMap();
Map<String, Object> model = new HashMap<String, Object>();
model.put("myattr", "myvalue");
fv.render(model, request, response);
@ -124,7 +123,7 @@ public class FreeMarkerViewTests { @@ -124,7 +123,7 @@ public class FreeMarkerViewTests {
WebApplicationContext wac = mock(WebApplicationContext.class);
MockServletContext sc = new MockServletContext();
Map configs = new HashMap();
Map<String, FreeMarkerConfig> configs = new HashMap<String, FreeMarkerConfig>();
FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
configurer.setConfiguration(new TestConfiguration());
configs.put("configurer", configurer);
@ -141,7 +140,7 @@ public class FreeMarkerViewTests { @@ -141,7 +140,7 @@ public class FreeMarkerViewTests {
HttpServletResponse response = new MockHttpServletResponse();
response.setContentType("myContentType");
Map model = new HashMap();
Map<String, Object> model = new HashMap<String, Object>();
model.put("myattr", "myvalue");
fv.render(model, request, response);
@ -185,7 +184,7 @@ public class FreeMarkerViewTests { @@ -185,7 +184,7 @@ public class FreeMarkerViewTests {
@Override
public Template getTemplate(String name, final Locale locale) throws IOException {
if (name.equals("templateName") || name.equals("prefix_test_suffix")) {
return new Template(name, new StringReader("test")) {
return new Template(name, new StringReader("test"), this) {
@Override
public void process(Object model, Writer writer) throws TemplateException, IOException {
assertEquals(Locale.US, locale);

Loading…
Cancel
Save