Skip to content

Commit aa5c12c

Browse files
committed
Polishing
1 parent 67a65ea commit aa5c12c

File tree

7 files changed

+29
-25
lines changed

7 files changed

+29
-25
lines changed

spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1898,7 +1898,7 @@ public void SPR12522() {
18981898
}
18991899

19001900
@Test
1901-
public void SPR12803() throws Exception {
1901+
public void SPR12803() {
19021902
StandardEvaluationContext sec = new StandardEvaluationContext();
19031903
sec.setVariable("iterable", Collections.emptyList());
19041904
SpelExpressionParser parser = new SpelExpressionParser();
@@ -1907,7 +1907,7 @@ public void SPR12803() throws Exception {
19071907
}
19081908

19091909
@Test
1910-
public void SPR12808() throws Exception {
1910+
public void SPR12808() {
19111911
SpelExpressionParser parser = new SpelExpressionParser();
19121912
Expression expression = parser.parseExpression("T(org.springframework.expression.spel.SpelReproTests.DistanceEnforcer).from(#no)");
19131913
StandardEvaluationContext sec = new StandardEvaluationContext();
@@ -2092,9 +2092,9 @@ public List<ListOf> getList() {
20922092
}
20932093

20942094

2095-
private static enum ABC { A, B, C }
2095+
private enum ABC { A, B, C }
20962096

2097-
private static enum XYZ { X, Y, Z }
2097+
private enum XYZ { X, Y, Z }
20982098

20992099

21002100
public static class BooleanHolder {
@@ -2121,9 +2121,9 @@ public boolean isPrimitiveProperty() {
21212121
}
21222122

21232123

2124-
private static interface GenericInterface<T extends Number> {
2124+
private interface GenericInterface<T extends Number> {
21252125

2126-
public T getProperty();
2126+
T getProperty();
21272127
}
21282128

21292129

@@ -2148,9 +2148,9 @@ public static class OnlyBridgeMethod extends PackagePrivateClassWithGetter {
21482148
}
21492149

21502150

2151-
public static interface StaticFinal {
2151+
public interface StaticFinal {
21522152

2153-
public static final String VALUE = "interfaceValue";
2153+
String VALUE = "interfaceValue";
21542154
}
21552155

21562156

@@ -2227,7 +2227,7 @@ public Object resolve(EvaluationContext context, String beanName) throws AccessE
22272227
}
22282228

22292229

2230-
@SuppressWarnings({ "rawtypes", "serial" })
2230+
@SuppressWarnings({"rawtypes", "serial"})
22312231
public static class MapWithConstant extends HashMap {
22322232

22332233
public static final int X = 1;

spring-web/src/main/java/org/springframework/web/method/support/ModelAndViewContainer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ private boolean useDefaultModel() {
147147
* model (redirect URL preparation). Use of this method may be needed for
148148
* advanced cases when access to the "default" model is needed regardless,
149149
* e.g. to save model attributes specified via {@code @SessionAttributes}.
150-
* @return the default model, never {@code null}
150+
* @return the default model (never {@code null})
151+
* @since 4.1.4
151152
*/
152153
public ModelMap getDefaultModel() {
153154
return this.defaultModel;

spring-web/src/test/java/org/springframework/http/server/ServletServerHttpRequestTests.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ public void getURI() throws Exception {
6464
assertEquals("Invalid uri", uri, request.getURI());
6565
}
6666

67-
// SPR-13876
68-
69-
@Test
67+
@Test // SPR-13876
7068
public void getUriWithEncoding() throws Exception {
7169
URI uri = new URI("https://example.com/%E4%B8%AD%E6%96%87" +
7270
"?redirect=https%3A%2F%2Fgithub.com%2Fspring-projects%2Fspring-framework");

spring-web/src/test/java/org/springframework/web/method/support/InvocableHandlerMethodTests.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import org.springframework.web.context.request.NativeWebRequest;
3030
import org.springframework.web.context.request.ServletWebRequest;
3131

32-
import static org.hamcrest.Matchers.containsString;
32+
import static org.hamcrest.Matchers.*;
3333
import static org.junit.Assert.*;
3434

3535
/**
@@ -196,9 +196,7 @@ public void invocationTargetException() throws Exception {
196196
}
197197
}
198198

199-
// SPR-13917
200-
201-
@Test
199+
@Test // SPR-13917
202200
public void invocationErrorMessage() throws Exception {
203201
HandlerMethodArgumentResolverComposite composite = new HandlerMethodArgumentResolverComposite();
204202
composite.addResolver(new StubArgumentResolver(double.class, null));

spring-web/src/test/java/org/springframework/web/method/support/ModelAndViewContainerTests.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@
1616

1717
package org.springframework.web.method.support;
1818

19-
import static org.junit.Assert.assertEquals;
20-
import static org.junit.Assert.assertTrue;
21-
2219
import org.junit.Before;
2320
import org.junit.Test;
21+
2422
import org.springframework.ui.ModelMap;
2523

24+
import static org.junit.Assert.*;
2625

2726
/**
2827
* Test fixture for {@link ModelAndViewContainer}.
@@ -76,7 +75,7 @@ public void ignoreDefaultModel() {
7675
assertTrue(this.mavContainer.getModel().isEmpty());
7776
}
7877

79-
@Test // SPR-14045
78+
@Test // SPR-14045
8079
public void ignoreDefaultModelAndWithoutRedirectModel() {
8180
this.mavContainer.setIgnoreDefaultModelOnRedirect(true);
8281
this.mavContainer.setRedirectModelScenario(true);

spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ModelAndViewMethodReturnValueHandlerTests.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public class ModelAndViewMethodReturnValueHandlerTests {
4747

4848
private MethodParameter returnParamModelAndView;
4949

50+
5051
@Before
5152
public void setUp() throws Exception {
5253
this.handler = new ModelAndViewMethodReturnValueHandler();
@@ -55,6 +56,7 @@ public void setUp() throws Exception {
5556
this.returnParamModelAndView = getReturnValueParam("modelAndView");
5657
}
5758

59+
5860
@Test
5961
public void supportsReturnType() throws Exception {
6062
assertTrue(handler.supportsReturnType(returnParamModelAndView));
@@ -143,7 +145,7 @@ public void handleRedirectAttributesWithoutRedirect() throws Exception {
143145
assertNotSame("RedirectAttributes should not be used if controller doesn't redirect", redirectAttributes, model);
144146
}
145147

146-
@Test // SPR-14045
148+
@Test // SPR-14045
147149
public void handleRedirectWithIgnoreDefaultModel() throws Exception {
148150
mavContainer.setIgnoreDefaultModelOnRedirect(true);
149151

@@ -163,6 +165,7 @@ private MethodParameter getReturnValueParam(String methodName) throws Exception
163165
return new MethodParameter(method, -1);
164166
}
165167

168+
166169
@SuppressWarnings("unused")
167170
ModelAndView modelAndView() {
168171
return null;

spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ModelAndViewResolverMethodReturnValueHandlerTests.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -50,6 +50,7 @@ public class ModelAndViewResolverMethodReturnValueHandlerTests {
5050

5151
private ServletWebRequest request;
5252

53+
5354
@Before
5455
public void setUp() {
5556
mavResolvers = new ArrayList<ModelAndViewResolver>();
@@ -58,6 +59,7 @@ public void setUp() {
5859
request = new ServletWebRequest(new MockHttpServletRequest());
5960
}
6061

62+
6163
@Test
6264
public void modelAndViewResolver() throws Exception {
6365
MethodParameter returnType = new MethodParameter(getClass().getDeclaredMethod("testBeanReturnValue"), -1);
@@ -71,7 +73,7 @@ public void modelAndViewResolver() throws Exception {
7173
assertFalse(mavContainer.isRequestHandled());
7274
}
7375

74-
@Test(expected=UnsupportedOperationException.class)
76+
@Test(expected = UnsupportedOperationException.class)
7577
public void modelAndViewResolverUnresolved() throws Exception {
7678
MethodParameter returnType = new MethodParameter(getClass().getDeclaredMethod("intReturnValue"), -1);
7779
mavResolvers.add(new TestModelAndViewResolver(TestBean.class));
@@ -88,7 +90,7 @@ public void handleNull() throws Exception {
8890
assertTrue(mavContainer.getModel().isEmpty());
8991
}
9092

91-
@Test(expected=UnsupportedOperationException.class)
93+
@Test(expected = UnsupportedOperationException.class)
9294
public void handleSimpleType() throws Exception {
9395
MethodParameter returnType = new MethodParameter(getClass().getDeclaredMethod("intReturnValue"), -1);
9496
handler.handleReturnValue(55, returnType, mavContainer, request);
@@ -102,6 +104,7 @@ public void handleNonSimpleType() throws Exception{
102104
assertTrue(mavContainer.containsAttribute("testBean"));
103105
}
104106

107+
105108
@SuppressWarnings("unused")
106109
private int intReturnValue() {
107110
return 0;
@@ -112,6 +115,7 @@ private TestBean testBeanReturnValue() {
112115
return null;
113116
}
114117

118+
115119
private static class TestModelAndViewResolver implements ModelAndViewResolver {
116120

117121
private Class<?> returnValueType;
@@ -132,4 +136,5 @@ public ModelAndView resolveModelAndView(Method method, Class handlerType, Object
132136
}
133137
}
134138
}
139+
135140
}

0 commit comments

Comments
 (0)