Polishing
This commit is contained in:
parent
67a65ea600
commit
aa5c12c534
|
@ -1898,7 +1898,7 @@ public class SpelReproTests extends AbstractExpressionTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void SPR12803() throws Exception {
|
public void SPR12803() {
|
||||||
StandardEvaluationContext sec = new StandardEvaluationContext();
|
StandardEvaluationContext sec = new StandardEvaluationContext();
|
||||||
sec.setVariable("iterable", Collections.emptyList());
|
sec.setVariable("iterable", Collections.emptyList());
|
||||||
SpelExpressionParser parser = new SpelExpressionParser();
|
SpelExpressionParser parser = new SpelExpressionParser();
|
||||||
|
@ -1907,7 +1907,7 @@ public class SpelReproTests extends AbstractExpressionTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void SPR12808() throws Exception {
|
public void SPR12808() {
|
||||||
SpelExpressionParser parser = new SpelExpressionParser();
|
SpelExpressionParser parser = new SpelExpressionParser();
|
||||||
Expression expression = parser.parseExpression("T(org.springframework.expression.spel.SpelReproTests.DistanceEnforcer).from(#no)");
|
Expression expression = parser.parseExpression("T(org.springframework.expression.spel.SpelReproTests.DistanceEnforcer).from(#no)");
|
||||||
StandardEvaluationContext sec = new StandardEvaluationContext();
|
StandardEvaluationContext sec = new StandardEvaluationContext();
|
||||||
|
@ -2092,9 +2092,9 @@ public class SpelReproTests extends AbstractExpressionTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static enum ABC { A, B, C }
|
private enum ABC { A, B, C }
|
||||||
|
|
||||||
private static enum XYZ { X, Y, Z }
|
private enum XYZ { X, Y, Z }
|
||||||
|
|
||||||
|
|
||||||
public static class BooleanHolder {
|
public static class BooleanHolder {
|
||||||
|
@ -2121,9 +2121,9 @@ public class SpelReproTests extends AbstractExpressionTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static interface GenericInterface<T extends Number> {
|
private interface GenericInterface<T extends Number> {
|
||||||
|
|
||||||
public T getProperty();
|
T getProperty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2148,9 +2148,9 @@ public class SpelReproTests extends AbstractExpressionTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static interface StaticFinal {
|
public interface StaticFinal {
|
||||||
|
|
||||||
public static final String VALUE = "interfaceValue";
|
String VALUE = "interfaceValue";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,8 @@ public class ModelAndViewContainer {
|
||||||
* model (redirect URL preparation). Use of this method may be needed for
|
* model (redirect URL preparation). Use of this method may be needed for
|
||||||
* advanced cases when access to the "default" model is needed regardless,
|
* advanced cases when access to the "default" model is needed regardless,
|
||||||
* e.g. to save model attributes specified via {@code @SessionAttributes}.
|
* e.g. to save model attributes specified via {@code @SessionAttributes}.
|
||||||
* @return the default model, never {@code null}
|
* @return the default model (never {@code null})
|
||||||
|
* @since 4.1.4
|
||||||
*/
|
*/
|
||||||
public ModelMap getDefaultModel() {
|
public ModelMap getDefaultModel() {
|
||||||
return this.defaultModel;
|
return this.defaultModel;
|
||||||
|
|
|
@ -64,9 +64,7 @@ public class ServletServerHttpRequestTests {
|
||||||
assertEquals("Invalid uri", uri, request.getURI());
|
assertEquals("Invalid uri", uri, request.getURI());
|
||||||
}
|
}
|
||||||
|
|
||||||
// SPR-13876
|
@Test // SPR-13876
|
||||||
|
|
||||||
@Test
|
|
||||||
public void getUriWithEncoding() throws Exception {
|
public void getUriWithEncoding() throws Exception {
|
||||||
URI uri = new URI("https://example.com/%E4%B8%AD%E6%96%87" +
|
URI uri = new URI("https://example.com/%E4%B8%AD%E6%96%87" +
|
||||||
"?redirect=https%3A%2F%2Fgithub.com%2Fspring-projects%2Fspring-framework");
|
"?redirect=https%3A%2F%2Fgithub.com%2Fspring-projects%2Fspring-framework");
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.springframework.web.bind.support.WebDataBinderFactory;
|
||||||
import org.springframework.web.context.request.NativeWebRequest;
|
import org.springframework.web.context.request.NativeWebRequest;
|
||||||
import org.springframework.web.context.request.ServletWebRequest;
|
import org.springframework.web.context.request.ServletWebRequest;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.*;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -196,9 +196,7 @@ public class InvocableHandlerMethodTests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SPR-13917
|
@Test // SPR-13917
|
||||||
|
|
||||||
@Test
|
|
||||||
public void invocationErrorMessage() throws Exception {
|
public void invocationErrorMessage() throws Exception {
|
||||||
HandlerMethodArgumentResolverComposite composite = new HandlerMethodArgumentResolverComposite();
|
HandlerMethodArgumentResolverComposite composite = new HandlerMethodArgumentResolverComposite();
|
||||||
composite.addResolver(new StubArgumentResolver(double.class, null));
|
composite.addResolver(new StubArgumentResolver(double.class, null));
|
||||||
|
|
|
@ -16,13 +16,12 @@
|
||||||
|
|
||||||
package org.springframework.web.method.support;
|
package org.springframework.web.method.support;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test fixture for {@link ModelAndViewContainer}.
|
* Test fixture for {@link ModelAndViewContainer}.
|
||||||
|
|
|
@ -47,6 +47,7 @@ public class ModelAndViewMethodReturnValueHandlerTests {
|
||||||
|
|
||||||
private MethodParameter returnParamModelAndView;
|
private MethodParameter returnParamModelAndView;
|
||||||
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
this.handler = new ModelAndViewMethodReturnValueHandler();
|
this.handler = new ModelAndViewMethodReturnValueHandler();
|
||||||
|
@ -55,6 +56,7 @@ public class ModelAndViewMethodReturnValueHandlerTests {
|
||||||
this.returnParamModelAndView = getReturnValueParam("modelAndView");
|
this.returnParamModelAndView = getReturnValueParam("modelAndView");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void supportsReturnType() throws Exception {
|
public void supportsReturnType() throws Exception {
|
||||||
assertTrue(handler.supportsReturnType(returnParamModelAndView));
|
assertTrue(handler.supportsReturnType(returnParamModelAndView));
|
||||||
|
@ -163,6 +165,7 @@ public class ModelAndViewMethodReturnValueHandlerTests {
|
||||||
return new MethodParameter(method, -1);
|
return new MethodParameter(method, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
ModelAndView modelAndView() {
|
ModelAndView modelAndView() {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -50,6 +50,7 @@ public class ModelAndViewResolverMethodReturnValueHandlerTests {
|
||||||
|
|
||||||
private ServletWebRequest request;
|
private ServletWebRequest request;
|
||||||
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
mavResolvers = new ArrayList<ModelAndViewResolver>();
|
mavResolvers = new ArrayList<ModelAndViewResolver>();
|
||||||
|
@ -58,6 +59,7 @@ public class ModelAndViewResolverMethodReturnValueHandlerTests {
|
||||||
request = new ServletWebRequest(new MockHttpServletRequest());
|
request = new ServletWebRequest(new MockHttpServletRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void modelAndViewResolver() throws Exception {
|
public void modelAndViewResolver() throws Exception {
|
||||||
MethodParameter returnType = new MethodParameter(getClass().getDeclaredMethod("testBeanReturnValue"), -1);
|
MethodParameter returnType = new MethodParameter(getClass().getDeclaredMethod("testBeanReturnValue"), -1);
|
||||||
|
@ -102,6 +104,7 @@ public class ModelAndViewResolverMethodReturnValueHandlerTests {
|
||||||
assertTrue(mavContainer.containsAttribute("testBean"));
|
assertTrue(mavContainer.containsAttribute("testBean"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private int intReturnValue() {
|
private int intReturnValue() {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -112,6 +115,7 @@ public class ModelAndViewResolverMethodReturnValueHandlerTests {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static class TestModelAndViewResolver implements ModelAndViewResolver {
|
private static class TestModelAndViewResolver implements ModelAndViewResolver {
|
||||||
|
|
||||||
private Class<?> returnValueType;
|
private Class<?> returnValueType;
|
||||||
|
@ -132,4 +136,5 @@ public class ModelAndViewResolverMethodReturnValueHandlerTests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue