Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
(cherry picked from commit aa5c12c)
  • Loading branch information
jhoeller committed Apr 8, 2016
1 parent 3abe75b commit 4ae0659
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import static org.junit.Assert.*;

/**
*
* @author Stephane Nicoll
*/
public class CronTriggerFactoryBeanTests {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import static org.junit.Assert.*;

/**
*
* @author Stephane Nicoll
*/
public class SimpleTriggerFactoryBeanTests {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1901,7 +1901,7 @@ public void SPR12522() {
}

@Test
public void SPR12803() throws Exception {
public void SPR12803() {
StandardEvaluationContext sec = new StandardEvaluationContext();
sec.setVariable("iterable", Collections.emptyList());
SpelExpressionParser parser = new SpelExpressionParser();
Expand All @@ -1910,7 +1910,7 @@ public void SPR12803() throws Exception {
}

@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();
Expand Down Expand Up @@ -2123,9 +2123,9 @@ public List<ListOf> getList() {
}


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 {
Expand All @@ -2152,9 +2152,9 @@ public boolean isPrimitiveProperty() {
}


private static interface GenericInterface<T extends Number> {
private interface GenericInterface<T extends Number> {

public T getProperty();
T getProperty();
}


Expand All @@ -2179,9 +2179,9 @@ public static class OnlyBridgeMethod extends PackagePrivateClassWithGetter {
}


public static interface StaticFinal {
public interface StaticFinal {

public static final String VALUE = "interfaceValue";
String VALUE = "interfaceValue";
}


Expand Down Expand Up @@ -2258,7 +2258,7 @@ public Object resolve(EvaluationContext context, String beanName) throws AccessE
}


@SuppressWarnings({ "rawtypes", "serial" })
@SuppressWarnings({"rawtypes", "serial"})
public static class MapWithConstant extends HashMap {

public static final int X = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ public void setBindingDisabled(String attributeName) {

/**
* Whether binding is disabled for the given model attribute.
* @since 4.3
*/
public boolean isBindingDisabled(String name) {
return this.bindingDisabledAttributes.contains(name);
Expand All @@ -172,7 +173,8 @@ private boolean useDefaultModel() {
* 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;
Expand Down Expand Up @@ -215,6 +217,7 @@ public void setStatus(HttpStatus status) {

/**
* Return the configured HTTP status, if any.
* @since 4.3
*/
public HttpStatus getStatus() {
return this.status;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ public void getURI() throws Exception {
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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
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.*;

/**
Expand Down Expand Up @@ -196,9 +196,7 @@ public void invocationTargetException() throws Exception {
}
}

// SPR-13917

@Test
@Test // SPR-13917
public void invocationErrorMessage() throws Exception {
HandlerMethodArgumentResolverComposite composite = new HandlerMethodArgumentResolverComposite();
composite.addResolver(new StubArgumentResolver(double.class, null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
Expand Down Expand Up @@ -76,7 +75,7 @@ public void ignoreDefaultModel() {
assertTrue(this.mavContainer.getModel().isEmpty());
}

@Test // SPR-14045
@Test // SPR-14045
public void ignoreDefaultModelAndWithoutRedirectModel() {
this.mavContainer.setIgnoreDefaultModelOnRedirect(true);
this.mavContainer.setRedirectModelScenario(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class ModelAndViewMethodReturnValueHandlerTests {

private MethodParameter returnParamModelAndView;


@Before
public void setUp() throws Exception {
this.handler = new ModelAndViewMethodReturnValueHandler();
Expand All @@ -55,6 +56,7 @@ public void setUp() throws Exception {
this.returnParamModelAndView = getReturnValueParam("modelAndView");
}


@Test
public void supportsReturnType() throws Exception {
assertTrue(handler.supportsReturnType(returnParamModelAndView));
Expand Down Expand Up @@ -143,7 +145,7 @@ public void handleRedirectAttributesWithoutRedirect() throws Exception {
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);

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


@SuppressWarnings("unused")
ModelAndView modelAndView() {
return null;
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -50,6 +50,7 @@ public class ModelAndViewResolverMethodReturnValueHandlerTests {

private ServletWebRequest request;


@Before
public void setUp() {
mavResolvers = new ArrayList<ModelAndViewResolver>();
Expand All @@ -58,6 +59,7 @@ public void setUp() {
request = new ServletWebRequest(new MockHttpServletRequest());
}


@Test
public void modelAndViewResolver() throws Exception {
MethodParameter returnType = new MethodParameter(getClass().getDeclaredMethod("testBeanReturnValue"), -1);
Expand All @@ -71,7 +73,7 @@ public void modelAndViewResolver() throws Exception {
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));
Expand All @@ -88,7 +90,7 @@ public void handleNull() throws Exception {
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);
Expand All @@ -102,6 +104,7 @@ public void handleNonSimpleType() throws Exception{
assertTrue(mavContainer.containsAttribute("testBean"));
}


@SuppressWarnings("unused")
private int intReturnValue() {
return 0;
Expand All @@ -112,6 +115,7 @@ private TestBean testBeanReturnValue() {
return null;
}


private static class TestModelAndViewResolver implements ModelAndViewResolver {

private Class<?> returnValueType;
Expand All @@ -132,4 +136,5 @@ public ModelAndView resolveModelAndView(Method method, Class handlerType, Object
}
}
}

}

0 comments on commit 4ae0659

Please sign in to comment.