Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrannen committed Mar 31, 2020
1 parent 95ef9c2 commit ddaf002
Showing 1 changed file with 22 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -31,11 +31,13 @@
* @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", "");
Expand All @@ -58,8 +60,7 @@ public void testIntParameter() throws ServletRequestBindingException {
}

@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");
Expand All @@ -78,8 +79,7 @@ public void testIntParameters() throws ServletRequestBindingException {
}

@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", "");
Expand All @@ -102,8 +102,7 @@ public void testLongParameter() throws ServletRequestBindingException {
}

@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");
Expand All @@ -127,8 +126,7 @@ public void testLongParameters() throws ServletRequestBindingException {
}

@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", "");
Expand All @@ -151,8 +149,7 @@ public void testFloatParameter() throws ServletRequestBindingException {
}

@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");
Expand All @@ -167,8 +164,7 @@ public void testFloatParameters() throws ServletRequestBindingException {
}

@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", "");
Expand All @@ -191,8 +187,7 @@ public void testDoubleParameter() throws ServletRequestBindingException {
}

@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");
Expand All @@ -206,8 +201,7 @@ public void testDoubleParameters() throws ServletRequestBindingException {
}

@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");
Expand Down Expand Up @@ -235,8 +229,7 @@ public void testBooleanParameter() throws ServletRequestBindingException {
}

@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");
Expand All @@ -259,8 +252,7 @@ public void testBooleanParameters() throws ServletRequestBindingException {
}

@Test
public void testStringParameter() throws ServletRequestBindingException {
MockHttpServletRequest request = new MockHttpServletRequest();
void testStringParameter() throws ServletRequestBindingException {
request.addParameter("param1", "str");
request.addParameter("paramEmpty", "");

Expand All @@ -280,8 +272,7 @@ public void testStringParameter() throws ServletRequestBindingException {

@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++) {
Expand All @@ -294,8 +285,7 @@ public void testGetIntParameterWithDefaultValueHandlingIsFastEnough() {

@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++) {
Expand All @@ -308,8 +298,7 @@ public void testGetLongParameterWithDefaultValueHandlingIsFastEnough() {

@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++) {
Expand All @@ -322,8 +311,7 @@ public void testGetFloatParameterWithDefaultValueHandlingIsFastEnough() {

@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++) {
Expand All @@ -336,8 +324,7 @@ public void testGetDoubleParameterWithDefaultValueHandlingIsFastEnough() {

@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++) {
Expand All @@ -350,8 +337,7 @@ public void testGetBooleanParameterWithDefaultValueHandlingIsFastEnough() {

@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++) {
Expand Down

0 comments on commit ddaf002

Please sign in to comment.