提交 4ae06599 编写于 作者: J Juergen Hoeller

Polishing

(cherry picked from commit aa5c12c5)
上级 3abe75b2
......@@ -24,7 +24,6 @@ import org.quartz.CronTrigger;
import static org.junit.Assert.*;
/**
*
* @author Stephane Nicoll
*/
public class CronTriggerFactoryBeanTests {
......
......@@ -24,7 +24,6 @@ import org.quartz.SimpleTrigger;
import static org.junit.Assert.*;
/**
*
* @author Stephane Nicoll
*/
public class SimpleTriggerFactoryBeanTests {
......
......@@ -1901,7 +1901,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
@Test
public void SPR12803() throws Exception {
public void SPR12803() {
StandardEvaluationContext sec = new StandardEvaluationContext();
sec.setVariable("iterable", Collections.emptyList());
SpelExpressionParser parser = new SpelExpressionParser();
......@@ -1910,7 +1910,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
@Test
public void SPR12808() throws Exception {
public void SPR12808() {
SpelExpressionParser parser = new SpelExpressionParser();
Expression expression = parser.parseExpression("T(org.springframework.expression.spel.SpelReproTests.DistanceEnforcer).from(#no)");
StandardEvaluationContext sec = new StandardEvaluationContext();
......@@ -2123,9 +2123,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 {
......@@ -2152,9 +2152,9 @@ public class SpelReproTests extends AbstractExpressionTests {
}
private static interface GenericInterface<T extends Number> {
private interface GenericInterface<T extends Number> {
public T getProperty();
T getProperty();
}
......@@ -2179,9 +2179,9 @@ public class SpelReproTests extends AbstractExpressionTests {
}
public static interface StaticFinal {
public interface StaticFinal {
public static final String VALUE = "interfaceValue";
String VALUE = "interfaceValue";
}
......@@ -2258,7 +2258,7 @@ public class SpelReproTests extends AbstractExpressionTests {
}
@SuppressWarnings({ "rawtypes", "serial" })
@SuppressWarnings({"rawtypes", "serial"})
public static class MapWithConstant extends HashMap {
public static final int X = 1;
......
......@@ -153,6 +153,7 @@ public class ModelAndViewContainer {
/**
* Whether binding is disabled for the given model attribute.
* @since 4.3
*/
public boolean isBindingDisabled(String name) {
return this.bindingDisabledAttributes.contains(name);
......@@ -172,7 +173,8 @@ public class ModelAndViewContainer {
* model (redirect URL preparation). Use of this method may be needed for
* advanced cases when access to the "default" model is needed regardless,
* 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() {
return this.defaultModel;
......@@ -215,6 +217,7 @@ public class ModelAndViewContainer {
/**
* Return the configured HTTP status, if any.
* @since 4.3
*/
public HttpStatus getStatus() {
return this.status;
......
......@@ -64,9 +64,7 @@ public class ServletServerHttpRequestTests {
assertEquals("Invalid uri", uri, request.getURI());
}
// SPR-13876
@Test
@Test // SPR-13876
public void getUriWithEncoding() throws Exception {
URI uri = new URI("https://example.com/%E4%B8%AD%E6%96%87" +
"?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.ServletWebRequest;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
/**
......@@ -196,9 +196,7 @@ public class InvocableHandlerMethodTests {
}
}
// SPR-13917
@Test
@Test // SPR-13917
public void invocationErrorMessage() throws Exception {
HandlerMethodArgumentResolverComposite composite = new HandlerMethodArgumentResolverComposite();
composite.addResolver(new StubArgumentResolver(double.class, null));
......
......@@ -16,13 +16,12 @@
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.Test;
import org.springframework.ui.ModelMap;
import static org.junit.Assert.*;
/**
* Test fixture for {@link ModelAndViewContainer}.
......@@ -76,7 +75,7 @@ public class ModelAndViewContainerTests {
assertTrue(this.mavContainer.getModel().isEmpty());
}
@Test // SPR-14045
@Test // SPR-14045
public void ignoreDefaultModelAndWithoutRedirectModel() {
this.mavContainer.setIgnoreDefaultModelOnRedirect(true);
this.mavContainer.setRedirectModelScenario(true);
......
......@@ -47,6 +47,7 @@ public class ModelAndViewMethodReturnValueHandlerTests {
private MethodParameter returnParamModelAndView;
@Before
public void setUp() throws Exception {
this.handler = new ModelAndViewMethodReturnValueHandler();
......@@ -55,6 +56,7 @@ public class ModelAndViewMethodReturnValueHandlerTests {
this.returnParamModelAndView = getReturnValueParam("modelAndView");
}
@Test
public void supportsReturnType() throws Exception {
assertTrue(handler.supportsReturnType(returnParamModelAndView));
......@@ -143,7 +145,7 @@ public class ModelAndViewMethodReturnValueHandlerTests {
assertNotSame("RedirectAttributes should not be used if controller doesn't redirect", redirectAttributes, model);
}
@Test // SPR-14045
@Test // SPR-14045
public void handleRedirectWithIgnoreDefaultModel() throws Exception {
mavContainer.setIgnoreDefaultModelOnRedirect(true);
......@@ -163,6 +165,7 @@ public class ModelAndViewMethodReturnValueHandlerTests {
return new MethodParameter(method, -1);
}
@SuppressWarnings("unused")
ModelAndView modelAndView() {
return null;
......
/*
* 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.
......@@ -50,6 +50,7 @@ public class ModelAndViewResolverMethodReturnValueHandlerTests {
private ServletWebRequest request;
@Before
public void setUp() {
mavResolvers = new ArrayList<ModelAndViewResolver>();
......@@ -58,6 +59,7 @@ public class ModelAndViewResolverMethodReturnValueHandlerTests {
request = new ServletWebRequest(new MockHttpServletRequest());
}
@Test
public void modelAndViewResolver() throws Exception {
MethodParameter returnType = new MethodParameter(getClass().getDeclaredMethod("testBeanReturnValue"), -1);
......@@ -71,7 +73,7 @@ public class ModelAndViewResolverMethodReturnValueHandlerTests {
assertFalse(mavContainer.isRequestHandled());
}
@Test(expected=UnsupportedOperationException.class)
@Test(expected = UnsupportedOperationException.class)
public void modelAndViewResolverUnresolved() throws Exception {
MethodParameter returnType = new MethodParameter(getClass().getDeclaredMethod("intReturnValue"), -1);
mavResolvers.add(new TestModelAndViewResolver(TestBean.class));
......@@ -88,7 +90,7 @@ public class ModelAndViewResolverMethodReturnValueHandlerTests {
assertTrue(mavContainer.getModel().isEmpty());
}
@Test(expected=UnsupportedOperationException.class)
@Test(expected = UnsupportedOperationException.class)
public void handleSimpleType() throws Exception {
MethodParameter returnType = new MethodParameter(getClass().getDeclaredMethod("intReturnValue"), -1);
handler.handleReturnValue(55, returnType, mavContainer, request);
......@@ -102,6 +104,7 @@ public class ModelAndViewResolverMethodReturnValueHandlerTests {
assertTrue(mavContainer.containsAttribute("testBean"));
}
@SuppressWarnings("unused")
private int intReturnValue() {
return 0;
......@@ -112,6 +115,7 @@ public class ModelAndViewResolverMethodReturnValueHandlerTests {
return null;
}
private static class TestModelAndViewResolver implements ModelAndViewResolver {
private Class<?> returnValueType;
......@@ -132,4 +136,5 @@ public class ModelAndViewResolverMethodReturnValueHandlerTests {
}
}
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册