Polishing
This commit is contained in:
parent
95ef9c25c2
commit
ddaf0029ae
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 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.
|
||||
|
@ -31,11 +31,13 @@ import static org.springframework.core.testfixture.TestGroup.PERFORMANCE;
|
|||
* @author Chris Beams
|
||||
* @since 06.08.2003
|
||||
*/
|
||||
public class ServletRequestUtilsTests {
|
||||
class ServletRequestUtilsTests {
|
||||
|
||||
private final MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
|
||||
|
||||
@Test
|
||||
public void testIntParameter() throws ServletRequestBindingException {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
void testIntParameter() throws ServletRequestBindingException {
|
||||
request.addParameter("param1", "5");
|
||||
request.addParameter("param2", "e");
|
||||
request.addParameter("paramEmpty", "");
|
||||
|
@ -58,8 +60,7 @@ public class ServletRequestUtilsTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testIntParameters() throws ServletRequestBindingException {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
void testIntParameters() throws ServletRequestBindingException {
|
||||
request.addParameter("param", new String[] {"1", "2", "3"});
|
||||
|
||||
request.addParameter("param2", "1");
|
||||
|
@ -78,8 +79,7 @@ public class ServletRequestUtilsTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testLongParameter() throws ServletRequestBindingException {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
void testLongParameter() throws ServletRequestBindingException {
|
||||
request.addParameter("param1", "5");
|
||||
request.addParameter("param2", "e");
|
||||
request.addParameter("paramEmpty", "");
|
||||
|
@ -102,8 +102,7 @@ public class ServletRequestUtilsTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testLongParameters() throws ServletRequestBindingException {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
void testLongParameters() throws ServletRequestBindingException {
|
||||
request.setParameter("param", new String[] {"1", "2", "3"});
|
||||
|
||||
request.setParameter("param2", "0");
|
||||
|
@ -127,8 +126,7 @@ public class ServletRequestUtilsTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFloatParameter() throws ServletRequestBindingException {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
void testFloatParameter() throws ServletRequestBindingException {
|
||||
request.addParameter("param1", "5.5");
|
||||
request.addParameter("param2", "e");
|
||||
request.addParameter("paramEmpty", "");
|
||||
|
@ -151,8 +149,7 @@ public class ServletRequestUtilsTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFloatParameters() throws ServletRequestBindingException {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
void testFloatParameters() throws ServletRequestBindingException {
|
||||
request.addParameter("param", new String[] {"1.5", "2.5", "3"});
|
||||
|
||||
request.addParameter("param2", "1.5");
|
||||
|
@ -167,8 +164,7 @@ public class ServletRequestUtilsTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDoubleParameter() throws ServletRequestBindingException {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
void testDoubleParameter() throws ServletRequestBindingException {
|
||||
request.addParameter("param1", "5.5");
|
||||
request.addParameter("param2", "e");
|
||||
request.addParameter("paramEmpty", "");
|
||||
|
@ -191,8 +187,7 @@ public class ServletRequestUtilsTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDoubleParameters() throws ServletRequestBindingException {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
void testDoubleParameters() throws ServletRequestBindingException {
|
||||
request.addParameter("param", new String[] {"1.5", "2.5", "3"});
|
||||
|
||||
request.addParameter("param2", "1.5");
|
||||
|
@ -206,8 +201,7 @@ public class ServletRequestUtilsTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testBooleanParameter() throws ServletRequestBindingException {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
void testBooleanParameter() throws ServletRequestBindingException {
|
||||
request.addParameter("param1", "true");
|
||||
request.addParameter("param2", "e");
|
||||
request.addParameter("param4", "yes");
|
||||
|
@ -235,8 +229,7 @@ public class ServletRequestUtilsTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testBooleanParameters() throws ServletRequestBindingException {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
void testBooleanParameters() throws ServletRequestBindingException {
|
||||
request.addParameter("param", new String[] {"true", "yes", "off", "1", "bogus"});
|
||||
|
||||
request.addParameter("param2", "false");
|
||||
|
@ -259,8 +252,7 @@ public class ServletRequestUtilsTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testStringParameter() throws ServletRequestBindingException {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
void testStringParameter() throws ServletRequestBindingException {
|
||||
request.addParameter("param1", "str");
|
||||
request.addParameter("paramEmpty", "");
|
||||
|
||||
|
@ -280,8 +272,7 @@ public class ServletRequestUtilsTests {
|
|||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void testGetIntParameterWithDefaultValueHandlingIsFastEnough() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
void testGetIntParameterWithDefaultValueHandlingIsFastEnough() {
|
||||
StopWatch sw = new StopWatch();
|
||||
sw.start();
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
|
@ -294,8 +285,7 @@ public class ServletRequestUtilsTests {
|
|||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void testGetLongParameterWithDefaultValueHandlingIsFastEnough() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
void testGetLongParameterWithDefaultValueHandlingIsFastEnough() {
|
||||
StopWatch sw = new StopWatch();
|
||||
sw.start();
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
|
@ -308,8 +298,7 @@ public class ServletRequestUtilsTests {
|
|||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void testGetFloatParameterWithDefaultValueHandlingIsFastEnough() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
void testGetFloatParameterWithDefaultValueHandlingIsFastEnough() {
|
||||
StopWatch sw = new StopWatch();
|
||||
sw.start();
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
|
@ -322,8 +311,7 @@ public class ServletRequestUtilsTests {
|
|||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void testGetDoubleParameterWithDefaultValueHandlingIsFastEnough() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
void testGetDoubleParameterWithDefaultValueHandlingIsFastEnough() {
|
||||
StopWatch sw = new StopWatch();
|
||||
sw.start();
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
|
@ -336,8 +324,7 @@ public class ServletRequestUtilsTests {
|
|||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void testGetBooleanParameterWithDefaultValueHandlingIsFastEnough() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
void testGetBooleanParameterWithDefaultValueHandlingIsFastEnough() {
|
||||
StopWatch sw = new StopWatch();
|
||||
sw.start();
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
|
@ -350,8 +337,7 @@ public class ServletRequestUtilsTests {
|
|||
|
||||
@Test
|
||||
@EnabledForTestGroups(PERFORMANCE)
|
||||
public void testGetStringParameterWithDefaultValueHandlingIsFastEnough() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
void testGetStringParameterWithDefaultValueHandlingIsFastEnough() {
|
||||
StopWatch sw = new StopWatch();
|
||||
sw.start();
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
|
|
Loading…
Reference in New Issue