Polish tests
See gh-27248
This commit is contained in:
@@ -159,7 +159,7 @@ class CrossOriginTests {
|
||||
assertThat(config.getAllowCredentials()).isNull();
|
||||
assertThat(config.getAllowedHeaders()).containsExactly("*");
|
||||
assertThat(CollectionUtils.isEmpty(config.getExposedHeaders())).isTrue();
|
||||
assertThat(config.getMaxAge()).isEqualTo(new Long(1800));
|
||||
assertThat(config.getMaxAge()).isEqualTo(Long.valueOf(1800));
|
||||
}
|
||||
|
||||
@PathPatternsParameterizedTest
|
||||
@@ -173,7 +173,7 @@ class CrossOriginTests {
|
||||
assertThat(config.getAllowedOrigins()).containsExactly("https://site1.com", "https://site2.com");
|
||||
assertThat(config.getAllowedHeaders()).containsExactly("header1", "header2");
|
||||
assertThat(config.getExposedHeaders()).containsExactly("header3", "header4");
|
||||
assertThat(config.getMaxAge()).isEqualTo(new Long(123));
|
||||
assertThat(config.getMaxAge()).isEqualTo(Long.valueOf(123));
|
||||
assertThat(config.getAllowCredentials()).isFalse();
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@ class CrossOriginTests {
|
||||
assertThat(config.getAllowCredentials()).isNull();
|
||||
assertThat(config.getAllowedHeaders()).containsExactly("*");
|
||||
assertThat(CollectionUtils.isEmpty(config.getExposedHeaders())).isTrue();
|
||||
assertThat(config.getMaxAge()).isEqualTo(new Long(1800));
|
||||
assertThat(config.getMaxAge()).isEqualTo(Long.valueOf(1800));
|
||||
}
|
||||
|
||||
@PathPatternsParameterizedTest
|
||||
@@ -389,7 +389,7 @@ class CrossOriginTests {
|
||||
assertThat(chain).isNotNull();
|
||||
if (isPreFlightRequest) {
|
||||
Object handler = chain.getHandler();
|
||||
assertThat(handler.getClass().getSimpleName().equals("PreFlightHandler")).isTrue();
|
||||
assertThat(handler.getClass().getSimpleName()).isEqualTo("PreFlightHandler");
|
||||
DirectFieldAccessor accessor = new DirectFieldAccessor(handler);
|
||||
return (CorsConfiguration)accessor.getPropertyValue("config");
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
@@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 3.1
|
||||
*/
|
||||
public class RedirectAttributesModelMapTests {
|
||||
class RedirectAttributesModelMapTests {
|
||||
|
||||
private RedirectAttributesModelMap redirectAttributes;
|
||||
|
||||
@@ -54,13 +54,13 @@ public class RedirectAttributesModelMapTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addAttributePrimitiveType() {
|
||||
void addAttributePrimitiveType() {
|
||||
this.redirectAttributes.addAttribute("speed", 65);
|
||||
assertThat(this.redirectAttributes.get("speed")).isEqualTo("65");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addAttributeCustomType() {
|
||||
void addAttributeCustomType() {
|
||||
String attrName = "person";
|
||||
this.redirectAttributes.addAttribute(attrName, new TestBean("Fred"));
|
||||
|
||||
@@ -73,7 +73,7 @@ public class RedirectAttributesModelMapTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addAttributeToString() {
|
||||
void addAttributeToString() {
|
||||
String attrName = "person";
|
||||
RedirectAttributesModelMap model = new RedirectAttributesModelMap();
|
||||
model.addAttribute(attrName, new TestBean("Fred"));
|
||||
@@ -82,22 +82,22 @@ public class RedirectAttributesModelMapTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addAttributeValue() {
|
||||
void addAttributeValue() {
|
||||
this.redirectAttributes.addAttribute(new TestBean("Fred"));
|
||||
|
||||
assertThat(this.redirectAttributes.get("testBean")).isEqualTo("Fred");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addAllAttributesList() {
|
||||
this.redirectAttributes.addAllAttributes(Arrays.asList(new TestBean("Fred"), new Integer(5)));
|
||||
void addAllAttributesList() {
|
||||
this.redirectAttributes.addAllAttributes(Arrays.asList(new TestBean("Fred"), 5));
|
||||
|
||||
assertThat(this.redirectAttributes.get("testBean")).isEqualTo("Fred");
|
||||
assertThat(this.redirectAttributes.get("integer")).isEqualTo("5");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addAttributesMap() {
|
||||
void addAttributesMap() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("person", new TestBean("Fred"));
|
||||
map.put("age", 33);
|
||||
@@ -108,7 +108,7 @@ public class RedirectAttributesModelMapTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergeAttributes() {
|
||||
void mergeAttributes() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("person", new TestBean("Fred"));
|
||||
map.put("age", 33);
|
||||
@@ -121,14 +121,14 @@ public class RedirectAttributesModelMapTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void put() {
|
||||
void put() {
|
||||
this.redirectAttributes.put("testBean", new TestBean("Fred"));
|
||||
|
||||
assertThat(this.redirectAttributes.get("testBean")).isEqualTo("Fred");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void putAll() {
|
||||
void putAll() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("person", new TestBean("Fred"));
|
||||
map.put("age", 33);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2021 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,10 +50,10 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
* @author Alef Arendsen
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public class BindTagTests extends AbstractTagTests {
|
||||
class BindTagTests extends AbstractTagTests {
|
||||
|
||||
@Test
|
||||
public void bindTagWithoutErrors() throws JspException {
|
||||
void bindTagWithoutErrors() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
Errors errors = new ServletRequestDataBinder(new TestBean(), "tb").getBindingResult();
|
||||
pc.getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "tb", errors);
|
||||
@@ -76,7 +76,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bindTagWithGlobalErrors() throws JspException {
|
||||
void bindTagWithGlobalErrors() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
Errors errors = new ServletRequestDataBinder(new TestBean(), "tb").getBindingResult();
|
||||
errors.reject("code1", "message1");
|
||||
@@ -116,7 +116,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bindTagWithGlobalErrorsAndNoDefaultMessage() throws JspException {
|
||||
void bindTagWithGlobalErrorsAndNoDefaultMessage() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
Errors errors = new ServletRequestDataBinder(new TestBean(), "tb").getBindingResult();
|
||||
errors.reject("code1");
|
||||
@@ -150,7 +150,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bindTagWithGlobalErrorsAndDefaultMessageOnly() throws JspException {
|
||||
void bindTagWithGlobalErrorsAndDefaultMessageOnly() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
Errors errors = new ServletRequestDataBinder(new TestBean(), "tb").getBindingResult();
|
||||
errors.reject(null, "message1");
|
||||
@@ -186,7 +186,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bindStatusGetErrorMessagesAsString() throws JspException {
|
||||
void bindStatusGetErrorMessagesAsString() throws JspException {
|
||||
// one error (should not include delimiter)
|
||||
PageContext pc = createPageContext();
|
||||
Errors errors = new ServletRequestDataBinder(new TestBean(), "tb").getBindingResult();
|
||||
@@ -225,7 +225,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bindTagWithFieldErrors() throws JspException {
|
||||
void bindTagWithFieldErrors() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
TestBean tb = new TestBean();
|
||||
tb.setName("name1");
|
||||
@@ -263,7 +263,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
status = (BindStatus) pc.getAttribute(BindTag.STATUS_VARIABLE_NAME, PageContext.REQUEST_SCOPE);
|
||||
assertThat(status != null).as("Has status variable").isTrue();
|
||||
assertThat("age".equals(status.getExpression())).as("Correct expression").isTrue();
|
||||
assertThat(new Integer(0).equals(status.getValue())).as("Correct value").isTrue();
|
||||
assertThat(Integer.valueOf(0).equals(status.getValue())).as("Correct value").isTrue();
|
||||
assertThat("0".equals(status.getDisplayValue())).as("Correct displayValue").isTrue();
|
||||
assertThat(status.isError()).as("Correct isError").isTrue();
|
||||
assertThat(status.getErrorCodes().length == 1).as("Correct errorCodes").isTrue();
|
||||
@@ -295,7 +295,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bindTagWithFieldErrorsAndNoDefaultMessage() throws JspException {
|
||||
void bindTagWithFieldErrorsAndNoDefaultMessage() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
TestBean tb = new TestBean();
|
||||
tb.setName("name1");
|
||||
@@ -328,7 +328,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
status = (BindStatus) pc.getAttribute(BindTag.STATUS_VARIABLE_NAME, PageContext.REQUEST_SCOPE);
|
||||
assertThat(status != null).as("Has status variable").isTrue();
|
||||
assertThat("age".equals(status.getExpression())).as("Correct expression").isTrue();
|
||||
assertThat(new Integer(0).equals(status.getValue())).as("Correct value").isTrue();
|
||||
assertThat(Integer.valueOf(0).equals(status.getValue())).as("Correct value").isTrue();
|
||||
assertThat("0".equals(status.getDisplayValue())).as("Correct displayValue").isTrue();
|
||||
assertThat(status.isError()).as("Correct isError").isTrue();
|
||||
assertThat(status.getErrorCodes().length == 1).as("Correct errorCodes").isTrue();
|
||||
@@ -352,7 +352,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bindTagWithFieldErrorsAndDefaultMessageOnly() throws JspException {
|
||||
void bindTagWithFieldErrorsAndDefaultMessageOnly() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
TestBean tb = new TestBean();
|
||||
tb.setName("name1");
|
||||
@@ -386,7 +386,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
status = (BindStatus) pc.getAttribute(BindTag.STATUS_VARIABLE_NAME, PageContext.REQUEST_SCOPE);
|
||||
assertThat(status != null).as("Has status variable").isTrue();
|
||||
assertThat("age".equals(status.getExpression())).as("Correct expression").isTrue();
|
||||
assertThat(new Integer(0).equals(status.getValue())).as("Correct value").isTrue();
|
||||
assertThat(Integer.valueOf(0).equals(status.getValue())).as("Correct value").isTrue();
|
||||
assertThat("0".equals(status.getDisplayValue())).as("Correct displayValue").isTrue();
|
||||
assertThat(status.isError()).as("Correct isError").isTrue();
|
||||
assertThat(status.getErrorMessages().length == 1).as("Correct errorMessages").isTrue();
|
||||
@@ -411,7 +411,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bindTagWithNestedFieldErrors() throws JspException {
|
||||
void bindTagWithNestedFieldErrors() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
TestBean tb = new TestBean();
|
||||
tb.setName("name1");
|
||||
@@ -439,7 +439,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void propertyExposing() throws JspException {
|
||||
void propertyExposing() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
TestBean tb = new TestBean();
|
||||
tb.setName("name1");
|
||||
@@ -464,7 +464,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bindTagWithIndexedProperties() throws JspException {
|
||||
void bindTagWithIndexedProperties() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
IndexedTestBean tb = new IndexedTestBean();
|
||||
Errors errors = new ServletRequestDataBinder(tb, "tb").getBindingResult();
|
||||
@@ -492,7 +492,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bindTagWithMappedProperties() throws JspException {
|
||||
void bindTagWithMappedProperties() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
IndexedTestBean tb = new IndexedTestBean();
|
||||
Errors errors = new ServletRequestDataBinder(tb, "tb").getBindingResult();
|
||||
@@ -520,7 +520,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bindTagWithIndexedPropertiesAndCustomEditor() throws JspException {
|
||||
void bindTagWithIndexedPropertiesAndCustomEditor() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
IndexedTestBean tb = new IndexedTestBean();
|
||||
DataBinder binder = new ServletRequestDataBinder(tb, "tb");
|
||||
@@ -549,7 +549,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bindTagWithToStringAndHtmlEscaping() throws JspException {
|
||||
void bindTagWithToStringAndHtmlEscaping() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
BindTag tag = new BindTag();
|
||||
tag.setPageContext(pc);
|
||||
@@ -568,7 +568,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bindTagWithSetValueAndHtmlEscaping() throws JspException {
|
||||
void bindTagWithSetValueAndHtmlEscaping() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
BindTag tag = new BindTag();
|
||||
tag.setPageContext(pc);
|
||||
@@ -583,7 +583,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bindTagWithFieldButWithoutErrorsInstance() throws JspException {
|
||||
void bindTagWithFieldButWithoutErrorsInstance() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
BindTag tag = new BindTag();
|
||||
tag.setPageContext(pc);
|
||||
@@ -596,7 +596,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bindTagWithFieldButWithoutErrorsInstanceAndHtmlEscaping() throws JspException {
|
||||
void bindTagWithFieldButWithoutErrorsInstanceAndHtmlEscaping() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
BindTag tag = new BindTag();
|
||||
tag.setPageContext(pc);
|
||||
@@ -610,7 +610,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bindTagWithBeanButWithoutErrorsInstance() throws JspException {
|
||||
void bindTagWithBeanButWithoutErrorsInstance() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
BindTag tag = new BindTag();
|
||||
tag.setPageContext(pc);
|
||||
@@ -623,7 +623,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bindTagWithoutBean() throws JspException {
|
||||
void bindTagWithoutBean() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
BindTag tag = new BindTag();
|
||||
tag.setPageContext(pc);
|
||||
@@ -634,7 +634,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
|
||||
|
||||
@Test
|
||||
public void bindErrorsTagWithoutErrors() throws JspException {
|
||||
void bindErrorsTagWithoutErrors() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
Errors errors = new ServletRequestDataBinder(new TestBean(), "tb").getBindingResult();
|
||||
pc.getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "tb", errors);
|
||||
@@ -646,7 +646,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bindErrorsTagWithErrors() throws JspException {
|
||||
void bindErrorsTagWithErrors() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
Errors errors = new ServletRequestDataBinder(new TestBean(), "tb").getBindingResult();
|
||||
errors.reject("test", null, "test");
|
||||
@@ -659,7 +659,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bindErrorsTagWithoutBean() throws JspException {
|
||||
void bindErrorsTagWithoutBean() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
BindErrorsTag tag = new BindErrorsTag();
|
||||
tag.setPageContext(pc);
|
||||
@@ -669,7 +669,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
|
||||
|
||||
@Test
|
||||
public void nestedPathDoEndTag() throws JspException {
|
||||
void nestedPathDoEndTag() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
NestedPathTag tag = new NestedPathTag();
|
||||
tag.setPath("foo");
|
||||
@@ -681,7 +681,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nestedPathDoEndTagWithNesting() throws JspException {
|
||||
void nestedPathDoEndTagWithNesting() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
NestedPathTag tag = new NestedPathTag();
|
||||
tag.setPath("foo");
|
||||
@@ -701,7 +701,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nestedPathDoStartTagInternal() throws JspException {
|
||||
void nestedPathDoStartTagInternal() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
NestedPathTag tag = new NestedPathTag();
|
||||
tag.setPath("foo");
|
||||
@@ -713,7 +713,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nestedPathDoStartTagInternalWithNesting() throws JspException {
|
||||
void nestedPathDoStartTagInternalWithNesting() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
NestedPathTag tag = new NestedPathTag();
|
||||
tag.setPath("foo");
|
||||
@@ -746,7 +746,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nestedPathWithBindTag() throws JspException {
|
||||
void nestedPathWithBindTag() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
Errors errors = new ServletRequestDataBinder(new TestBean(), "tb").getBindingResult();
|
||||
pc.getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "tb", errors);
|
||||
@@ -788,7 +788,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nestedPathWithBindTagWithIgnoreNestedPath() throws JspException {
|
||||
void nestedPathWithBindTagWithIgnoreNestedPath() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
Errors errors = new ServletRequestDataBinder(new TestBean(), "tb2").getBindingResult();
|
||||
pc.getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "tb2", errors);
|
||||
@@ -810,7 +810,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void transformTagCorrectBehavior() throws JspException {
|
||||
void transformTagCorrectBehavior() throws JspException {
|
||||
// first set up the pagecontext and the bean
|
||||
PageContext pc = createPageContext();
|
||||
TestBean tb = new TestBean();
|
||||
@@ -855,7 +855,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void transformTagWithHtmlEscape() throws JspException {
|
||||
void transformTagWithHtmlEscape() throws JspException {
|
||||
// first set up the PageContext and the bean
|
||||
PageContext pc = createPageContext();
|
||||
TestBean tb = new TestBean();
|
||||
@@ -884,7 +884,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void transformTagOutsideBindTag() throws JspException {
|
||||
void transformTagOutsideBindTag() throws JspException {
|
||||
// first set up the pagecontext and the bean
|
||||
PageContext pc = createPageContext();
|
||||
TestBean tb = new TestBean();
|
||||
@@ -915,7 +915,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void transformTagNonExistingValue() throws JspException {
|
||||
void transformTagNonExistingValue() throws JspException {
|
||||
// first set up the pagecontext and the bean
|
||||
PageContext pc = createPageContext();
|
||||
TestBean tb = new TestBean();
|
||||
@@ -942,7 +942,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void transformTagWithSettingOfScope() throws JspException {
|
||||
void transformTagWithSettingOfScope() throws JspException {
|
||||
// first set up the pagecontext and the bean
|
||||
PageContext pc = createPageContext();
|
||||
TestBean tb = new TestBean();
|
||||
@@ -997,7 +997,7 @@ public class BindTagTests extends AbstractTagTests {
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@Test
|
||||
public void nestingInFormTag() throws JspException {
|
||||
void nestingInFormTag() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
TestBean tb = new TestBean();
|
||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
@@ -49,7 +49,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
|
||||
* @author Jeremy Grelle
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
class CheckboxTagTests extends AbstractFormTagTests {
|
||||
|
||||
private CheckboxTag tag;
|
||||
|
||||
@@ -68,7 +68,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withSingleValueBooleanObjectChecked() throws Exception {
|
||||
void withSingleValueBooleanObjectChecked() throws Exception {
|
||||
this.tag.setPath("someBoolean");
|
||||
int result = this.tag.doStartTag();
|
||||
assertThat(result).isEqualTo(Tag.SKIP_BODY);
|
||||
@@ -91,7 +91,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withIndexedBooleanObjectNotChecked() throws Exception {
|
||||
void withIndexedBooleanObjectNotChecked() throws Exception {
|
||||
this.tag.setPath("someMap[key]");
|
||||
int result = this.tag.doStartTag();
|
||||
assertThat(result).isEqualTo(Tag.SKIP_BODY);
|
||||
@@ -114,7 +114,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withSingleValueBooleanObjectCheckedAndDynamicAttributes() throws Exception {
|
||||
void withSingleValueBooleanObjectCheckedAndDynamicAttributes() throws Exception {
|
||||
String dynamicAttribute1 = "attr1";
|
||||
String dynamicAttribute2 = "attr2";
|
||||
|
||||
@@ -144,7 +144,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withSingleValueBooleanChecked() throws Exception {
|
||||
void withSingleValueBooleanChecked() throws Exception {
|
||||
this.tag.setPath("jedi");
|
||||
int result = this.tag.doStartTag();
|
||||
assertThat(result).isEqualTo(Tag.SKIP_BODY);
|
||||
@@ -164,7 +164,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withSingleValueBooleanObjectUnchecked() throws Exception {
|
||||
void withSingleValueBooleanObjectUnchecked() throws Exception {
|
||||
this.bean.setSomeBoolean(Boolean.FALSE);
|
||||
this.tag.setPath("someBoolean");
|
||||
int result = this.tag.doStartTag();
|
||||
@@ -186,7 +186,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withSingleValueBooleanUnchecked() throws Exception {
|
||||
void withSingleValueBooleanUnchecked() throws Exception {
|
||||
this.bean.setJedi(false);
|
||||
this.tag.setPath("jedi");
|
||||
int result = this.tag.doStartTag();
|
||||
@@ -208,7 +208,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withSingleValueNull() throws Exception {
|
||||
void withSingleValueNull() throws Exception {
|
||||
this.bean.setName(null);
|
||||
this.tag.setPath("name");
|
||||
this.tag.setValue("Rob Harrop");
|
||||
@@ -231,7 +231,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withSingleValueNotNull() throws Exception {
|
||||
void withSingleValueNotNull() throws Exception {
|
||||
this.bean.setName("Rob Harrop");
|
||||
this.tag.setPath("name");
|
||||
this.tag.setValue("Rob Harrop");
|
||||
@@ -254,7 +254,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withSingleValueAndEditor() throws Exception {
|
||||
void withSingleValueAndEditor() throws Exception {
|
||||
this.bean.setName("Rob Harrop");
|
||||
this.tag.setPath("name");
|
||||
this.tag.setValue(" Rob Harrop");
|
||||
@@ -281,7 +281,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withMultiValueChecked() throws Exception {
|
||||
void withMultiValueChecked() throws Exception {
|
||||
this.tag.setPath("stringArray");
|
||||
this.tag.setValue("foo");
|
||||
int result = this.tag.doStartTag();
|
||||
@@ -303,7 +303,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withMultiValueUnchecked() throws Exception {
|
||||
void withMultiValueUnchecked() throws Exception {
|
||||
this.tag.setPath("stringArray");
|
||||
this.tag.setValue("abc");
|
||||
int result = this.tag.doStartTag();
|
||||
@@ -325,7 +325,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withMultiValueWithEditor() throws Exception {
|
||||
void withMultiValueWithEditor() throws Exception {
|
||||
this.tag.setPath("stringArray");
|
||||
this.tag.setValue(" foo");
|
||||
BeanPropertyBindingResult bindingResult = new BeanPropertyBindingResult(this.bean, COMMAND_NAME);
|
||||
@@ -353,7 +353,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withMultiValueIntegerWithEditor() throws Exception {
|
||||
void withMultiValueIntegerWithEditor() throws Exception {
|
||||
this.tag.setPath("someIntegerArray");
|
||||
this.tag.setValue(" 1");
|
||||
BeanPropertyBindingResult bindingResult = new BeanPropertyBindingResult(this.bean, COMMAND_NAME);
|
||||
@@ -381,7 +381,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withCollection() throws Exception {
|
||||
void withCollection() throws Exception {
|
||||
this.tag.setPath("someList");
|
||||
this.tag.setValue("foo");
|
||||
int result = this.tag.doStartTag();
|
||||
@@ -403,7 +403,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withObjectChecked() throws Exception {
|
||||
void withObjectChecked() throws Exception {
|
||||
this.tag.setPath("date");
|
||||
this.tag.setValue(getDate());
|
||||
|
||||
@@ -426,7 +426,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withObjectUnchecked() throws Exception {
|
||||
void withObjectUnchecked() throws Exception {
|
||||
this.tag.setPath("date");
|
||||
Date date = new Date();
|
||||
this.tag.setValue(date);
|
||||
@@ -450,7 +450,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void collectionOfColoursSelected() throws Exception {
|
||||
void collectionOfColoursSelected() throws Exception {
|
||||
this.tag.setPath("otherColours");
|
||||
this.tag.setValue("RED");
|
||||
|
||||
@@ -472,7 +472,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void collectionOfColoursNotSelected() throws Exception {
|
||||
void collectionOfColoursNotSelected() throws Exception {
|
||||
this.tag.setPath("otherColours");
|
||||
this.tag.setValue("PURPLE");
|
||||
|
||||
@@ -494,7 +494,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void collectionOfPetsAsString() throws Exception {
|
||||
void collectionOfPetsAsString() throws Exception {
|
||||
this.tag.setPath("pets");
|
||||
this.tag.setValue("Spot");
|
||||
|
||||
@@ -516,7 +516,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void collectionOfPetsAsStringNotSelected() throws Exception {
|
||||
void collectionOfPetsAsStringNotSelected() throws Exception {
|
||||
this.tag.setPath("pets");
|
||||
this.tag.setValue("Santa's Little Helper");
|
||||
|
||||
@@ -538,7 +538,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void collectionOfPets() throws Exception {
|
||||
void collectionOfPets() throws Exception {
|
||||
this.tag.setPath("pets");
|
||||
this.tag.setValue(new Pet("Rudiger"));
|
||||
|
||||
@@ -561,7 +561,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void collectionOfPetsNotSelected() throws Exception {
|
||||
void collectionOfPetsNotSelected() throws Exception {
|
||||
this.tag.setPath("pets");
|
||||
this.tag.setValue(new Pet("Santa's Little Helper"));
|
||||
|
||||
@@ -584,7 +584,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void collectionOfPetsWithEditor() throws Exception {
|
||||
void collectionOfPetsWithEditor() throws Exception {
|
||||
this.tag.setPath("pets");
|
||||
this.tag.setValue(new ItemPet("Rudiger"));
|
||||
|
||||
@@ -612,14 +612,14 @@ public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withNullValue() throws Exception {
|
||||
void withNullValue() throws Exception {
|
||||
this.tag.setPath("name");
|
||||
assertThatIllegalArgumentException().as("null value binding to a non-boolean").isThrownBy(
|
||||
this.tag::doStartTag);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hiddenElementOmittedOnDisabled() throws Exception {
|
||||
void hiddenElementOmittedOnDisabled() throws Exception {
|
||||
this.tag.setPath("someBoolean");
|
||||
this.tag.setDisabled(true);
|
||||
int result = this.tag.doStartTag();
|
||||
@@ -642,7 +642,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dynamicTypeAttribute() throws JspException {
|
||||
void dynamicTypeAttribute() throws JspException {
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
this.tag.setDynamicAttribute(null, "type", "email"))
|
||||
.withMessage("Attribute type=\"email\" is not allowed");
|
||||
@@ -718,7 +718,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
|
||||
@Override
|
||||
public void setAsText(String text) {
|
||||
this.count++;
|
||||
setValue(new Integer(text.trim()));
|
||||
setValue(Integer.valueOf(text.trim()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
@@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
*/
|
||||
public class HiddenInputTagTests extends AbstractFormTagTests {
|
||||
class HiddenInputTagTests extends AbstractFormTagTests {
|
||||
|
||||
private HiddenInputTag tag;
|
||||
|
||||
@@ -49,7 +49,7 @@ public class HiddenInputTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void render() throws Exception {
|
||||
void render() throws Exception {
|
||||
this.tag.setPath("name");
|
||||
int result = this.tag.doStartTag();
|
||||
assertThat(result).isEqualTo(Tag.SKIP_BODY);
|
||||
@@ -65,7 +65,7 @@ public class HiddenInputTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withCustomBinder() throws Exception {
|
||||
void withCustomBinder() throws Exception {
|
||||
this.tag.setPath("myFloat");
|
||||
|
||||
BeanPropertyBindingResult errors = new BeanPropertyBindingResult(this.bean, COMMAND_NAME);
|
||||
@@ -84,14 +84,14 @@ public class HiddenInputTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dynamicTypeAttribute() throws JspException {
|
||||
void dynamicTypeAttribute() throws JspException {
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
this.tag.setDynamicAttribute(null, "type", "email"))
|
||||
.withMessage("Attribute type=\"email\" is not allowed");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void disabledTrue() throws Exception {
|
||||
void disabledTrue() throws Exception {
|
||||
this.tag.setDisabled(true);
|
||||
|
||||
this.tag.doStartTag();
|
||||
@@ -107,7 +107,7 @@ public class HiddenInputTagTests extends AbstractFormTagTests {
|
||||
// SPR-8661
|
||||
|
||||
@Test
|
||||
public void disabledFalse() throws Exception {
|
||||
void disabledFalse() throws Exception {
|
||||
this.tag.setDisabled(false);
|
||||
|
||||
this.tag.doStartTag();
|
||||
@@ -132,7 +132,7 @@ public class HiddenInputTagTests extends AbstractFormTagTests {
|
||||
protected TestBean createTestBean() {
|
||||
this.bean = new TestBean();
|
||||
bean.setName("Sally Greenwood");
|
||||
bean.setMyFloat(new Float("12.34"));
|
||||
bean.setMyFloat(Float.valueOf("12.34"));
|
||||
return bean;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ public class InputTagTests extends AbstractFormTagTests {
|
||||
// set up test data
|
||||
this.rob = new TestBean();
|
||||
this.rob.setName("Rob");
|
||||
this.rob.setMyFloat(new Float(12.34));
|
||||
this.rob.setMyFloat(Float.valueOf(12.34f));
|
||||
|
||||
TestBean sally = new TestBean();
|
||||
sally.setName("Sally");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
@@ -46,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||
* @author Jeremy Grelle
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public class OptionTagTests extends AbstractHtmlElementTagTests {
|
||||
class OptionTagTests extends AbstractHtmlElementTagTests {
|
||||
|
||||
private static final String ARRAY_SOURCE = "abc,123,def";
|
||||
|
||||
@@ -79,7 +79,7 @@ public class OptionTagTests extends AbstractHtmlElementTagTests {
|
||||
|
||||
|
||||
@Test
|
||||
public void canBeDisabledEvenWhenSelected() throws Exception {
|
||||
void canBeDisabledEvenWhenSelected() throws Exception {
|
||||
String selectName = "testBean.name";
|
||||
BindStatus bindStatus = new BindStatus(getRequestContext(), selectName, false);
|
||||
getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, bindStatus);
|
||||
@@ -101,7 +101,7 @@ public class OptionTagTests extends AbstractHtmlElementTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void renderNotSelected() throws Exception {
|
||||
void renderNotSelected() throws Exception {
|
||||
String selectName = "testBean.name";
|
||||
BindStatus bindStatus = new BindStatus(getRequestContext(), selectName, false);
|
||||
getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, bindStatus);
|
||||
@@ -121,7 +121,7 @@ public class OptionTagTests extends AbstractHtmlElementTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void renderWithDynamicAttributes() throws Exception {
|
||||
void renderWithDynamicAttributes() throws Exception {
|
||||
String dynamicAttribute1 = "attr1";
|
||||
String dynamicAttribute2 = "attr2";
|
||||
|
||||
@@ -149,7 +149,7 @@ public class OptionTagTests extends AbstractHtmlElementTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void renderSelected() throws Exception {
|
||||
void renderSelected() throws Exception {
|
||||
String selectName = "testBean.name";
|
||||
BindStatus bindStatus = new BindStatus(getRequestContext(), selectName, false);
|
||||
getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, bindStatus);
|
||||
@@ -172,7 +172,7 @@ public class OptionTagTests extends AbstractHtmlElementTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withNoLabel() throws Exception {
|
||||
void withNoLabel() throws Exception {
|
||||
String selectName = "testBean.name";
|
||||
BindStatus bindStatus = new BindStatus(getRequestContext(), selectName, false);
|
||||
getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, bindStatus);
|
||||
@@ -195,7 +195,7 @@ public class OptionTagTests extends AbstractHtmlElementTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withoutContext() throws Exception {
|
||||
void withoutContext() throws Exception {
|
||||
this.tag.setParent(null);
|
||||
this.tag.setValue("foo");
|
||||
this.tag.setLabel("Foo");
|
||||
@@ -204,7 +204,7 @@ public class OptionTagTests extends AbstractHtmlElementTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withPropertyEditor() throws Exception {
|
||||
void withPropertyEditor() throws Exception {
|
||||
String selectName = "testBean.stringArray";
|
||||
BindStatus bindStatus = new BindStatus(getRequestContext(), selectName, false) {
|
||||
@Override
|
||||
@@ -233,7 +233,7 @@ public class OptionTagTests extends AbstractHtmlElementTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withPropertyEditorStringComparison() throws Exception {
|
||||
void withPropertyEditorStringComparison() throws Exception {
|
||||
final PropertyEditor testBeanEditor = new TestBeanPropertyEditor();
|
||||
testBeanEditor.setValue(new TestBean("Sally"));
|
||||
String selectName = "testBean.spouse";
|
||||
@@ -261,11 +261,11 @@ public class OptionTagTests extends AbstractHtmlElementTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withCustomObjectSelected() throws Exception {
|
||||
void withCustomObjectSelected() throws Exception {
|
||||
String selectName = "testBean.someNumber";
|
||||
BindStatus bindStatus = new BindStatus(getRequestContext(), selectName, false);
|
||||
getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, bindStatus);
|
||||
this.tag.setValue(new Float(12.34));
|
||||
this.tag.setValue(12.34f);
|
||||
this.tag.setLabel("GBP 12.34");
|
||||
int result = this.tag.doStartTag();
|
||||
assertThat(result).isEqualTo(BodyTag.EVAL_BODY_BUFFERED);
|
||||
@@ -282,11 +282,11 @@ public class OptionTagTests extends AbstractHtmlElementTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withCustomObjectNotSelected() throws Exception {
|
||||
void withCustomObjectNotSelected() throws Exception {
|
||||
String selectName = "testBean.someNumber";
|
||||
BindStatus bindStatus = new BindStatus(getRequestContext(), selectName, false);
|
||||
getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, bindStatus);
|
||||
this.tag.setValue(new Float(12.35));
|
||||
this.tag.setValue(12.35f);
|
||||
this.tag.setLabel("GBP 12.35");
|
||||
int result = this.tag.doStartTag();
|
||||
assertThat(result).isEqualTo(BodyTag.EVAL_BODY_BUFFERED);
|
||||
@@ -303,9 +303,9 @@ public class OptionTagTests extends AbstractHtmlElementTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withCustomObjectAndEditorSelected() throws Exception {
|
||||
void withCustomObjectAndEditorSelected() throws Exception {
|
||||
final PropertyEditor floatEditor = new SimpleFloatEditor();
|
||||
floatEditor.setValue(new Float("12.34"));
|
||||
floatEditor.setValue(Float.valueOf("12.34"));
|
||||
String selectName = "testBean.someNumber";
|
||||
BindStatus bindStatus = new BindStatus(getRequestContext(), selectName, false) {
|
||||
@Override
|
||||
@@ -315,7 +315,7 @@ public class OptionTagTests extends AbstractHtmlElementTagTests {
|
||||
};
|
||||
getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, bindStatus);
|
||||
|
||||
this.tag.setValue(new Float(12.34));
|
||||
this.tag.setValue(12.34f);
|
||||
this.tag.setLabel("12.34f");
|
||||
|
||||
int result = this.tag.doStartTag();
|
||||
@@ -331,7 +331,7 @@ public class OptionTagTests extends AbstractHtmlElementTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withCustomObjectAndEditorNotSelected() throws Exception {
|
||||
void withCustomObjectAndEditorNotSelected() throws Exception {
|
||||
final PropertyEditor floatEditor = new SimpleFloatEditor();
|
||||
String selectName = "testBean.someNumber";
|
||||
BindStatus bindStatus = new BindStatus(getRequestContext(), selectName, false) {
|
||||
@@ -342,7 +342,7 @@ public class OptionTagTests extends AbstractHtmlElementTagTests {
|
||||
};
|
||||
getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, bindStatus);
|
||||
|
||||
this.tag.setValue(new Float(12.35));
|
||||
this.tag.setValue(12.35f);
|
||||
this.tag.setLabel("12.35f");
|
||||
|
||||
int result = this.tag.doStartTag();
|
||||
@@ -358,7 +358,7 @@ public class OptionTagTests extends AbstractHtmlElementTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void asBodyTag() throws Exception {
|
||||
void asBodyTag() throws Exception {
|
||||
String selectName = "testBean.name";
|
||||
BindStatus bindStatus = new BindStatus(getRequestContext(), selectName, false);
|
||||
getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, bindStatus);
|
||||
@@ -380,7 +380,7 @@ public class OptionTagTests extends AbstractHtmlElementTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void asBodyTagSelected() throws Exception {
|
||||
void asBodyTagSelected() throws Exception {
|
||||
String selectName = "testBean.name";
|
||||
BindStatus bindStatus = new BindStatus(getRequestContext(), selectName, false);
|
||||
getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, bindStatus);
|
||||
@@ -401,7 +401,7 @@ public class OptionTagTests extends AbstractHtmlElementTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void asBodyTagCollapsed() throws Exception {
|
||||
void asBodyTagCollapsed() throws Exception {
|
||||
String selectName = "testBean.name";
|
||||
BindStatus bindStatus = new BindStatus(getRequestContext(), selectName, false);
|
||||
getPageContext().setAttribute(SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, bindStatus);
|
||||
@@ -423,7 +423,7 @@ public class OptionTagTests extends AbstractHtmlElementTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void asBodyTagWithEditor() throws Exception {
|
||||
void asBodyTagWithEditor() throws Exception {
|
||||
String selectName = "testBean.stringArray";
|
||||
BindStatus bindStatus = new BindStatus(getRequestContext(), selectName, false) {
|
||||
@Override
|
||||
@@ -447,7 +447,7 @@ public class OptionTagTests extends AbstractHtmlElementTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void multiBind() throws Exception {
|
||||
void multiBind() throws Exception {
|
||||
BeanPropertyBindingResult result = new BeanPropertyBindingResult(new TestBean(), "testBean");
|
||||
result.getPropertyAccessor().registerCustomEditor(TestBean.class, "friends", new FriendEditor());
|
||||
exposeBindingResult(result);
|
||||
@@ -463,7 +463,7 @@ public class OptionTagTests extends AbstractHtmlElementTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void optionTagNotNestedWithinSelectTag() throws Exception {
|
||||
void optionTagNotNestedWithinSelectTag() throws Exception {
|
||||
tag.setParent(null);
|
||||
tag.setValue("foo");
|
||||
assertThatIllegalStateException().as("when not nested within a <select/> tag").isThrownBy(
|
||||
@@ -486,7 +486,7 @@ public class OptionTagTests extends AbstractHtmlElementTagTests {
|
||||
bean.setFavouriteColour(Colour.GREEN);
|
||||
bean.setStringArray(ARRAY);
|
||||
bean.setSpouse(new TestBean("Sally"));
|
||||
bean.setSomeNumber(new Float("12.34"));
|
||||
bean.setSomeNumber(Float.valueOf("12.34"));
|
||||
|
||||
List friends = new ArrayList();
|
||||
friends.add(new TestBean("bar"));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
@@ -53,7 +53,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Jeremy Grelle
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public class OptionsTagTests extends AbstractHtmlElementTagTests {
|
||||
class OptionsTagTests extends AbstractHtmlElementTagTests {
|
||||
|
||||
private static final String COMMAND_NAME = "testBean";
|
||||
|
||||
@@ -87,7 +87,7 @@ public class OptionsTagTests extends AbstractHtmlElementTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withCollection() throws Exception {
|
||||
void withCollection() throws Exception {
|
||||
getPageContext().setAttribute(
|
||||
SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, new BindStatus(getRequestContext(), "testBean.country", false));
|
||||
|
||||
@@ -117,7 +117,7 @@ public class OptionsTagTests extends AbstractHtmlElementTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withCollectionAndDynamicAttributes() throws Exception {
|
||||
void withCollectionAndDynamicAttributes() throws Exception {
|
||||
String dynamicAttribute1 = "attr1";
|
||||
String dynamicAttribute2 = "attr2";
|
||||
|
||||
@@ -155,11 +155,11 @@ public class OptionsTagTests extends AbstractHtmlElementTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withCollectionAndCustomEditor() throws Exception {
|
||||
void withCollectionAndCustomEditor() throws Exception {
|
||||
PropertyEditor propertyEditor = new SimpleFloatEditor();
|
||||
|
||||
TestBean target = new TestBean();
|
||||
target.setMyFloat(new Float("12.34"));
|
||||
target.setMyFloat(Float.valueOf("12.34"));
|
||||
|
||||
BeanPropertyBindingResult errors = new BeanPropertyBindingResult(target, COMMAND_NAME);
|
||||
errors.getPropertyAccessor().registerCustomEditor(Float.class, propertyEditor);
|
||||
@@ -169,12 +169,12 @@ public class OptionsTagTests extends AbstractHtmlElementTagTests {
|
||||
SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, new BindStatus(getRequestContext(), "testBean.myFloat", false));
|
||||
|
||||
List<Float> floats = new ArrayList<>();
|
||||
floats.add(new Float("12.30"));
|
||||
floats.add(new Float("12.31"));
|
||||
floats.add(new Float("12.32"));
|
||||
floats.add(new Float("12.33"));
|
||||
floats.add(new Float("12.34"));
|
||||
floats.add(new Float("12.35"));
|
||||
floats.add(Float.valueOf("12.30"));
|
||||
floats.add(Float.valueOf("12.31"));
|
||||
floats.add(Float.valueOf("12.32"));
|
||||
floats.add(Float.valueOf("12.33"));
|
||||
floats.add(Float.valueOf("12.34"));
|
||||
floats.add(Float.valueOf("12.35"));
|
||||
|
||||
this.tag.setItems(floats);
|
||||
int result = this.tag.doStartTag();
|
||||
@@ -201,7 +201,7 @@ public class OptionsTagTests extends AbstractHtmlElementTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withItemsNullReference() throws Exception {
|
||||
void withItemsNullReference() throws Exception {
|
||||
getPageContext().setAttribute(
|
||||
SelectTag.LIST_VALUE_PAGE_ATTRIBUTE, new BindStatus(getRequestContext(), "testBean.country", false));
|
||||
|
||||
@@ -222,7 +222,7 @@ public class OptionsTagTests extends AbstractHtmlElementTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withoutItems() throws Exception {
|
||||
void withoutItems() throws Exception {
|
||||
this.tag.setItemValue("isoCode");
|
||||
this.tag.setItemLabel("name");
|
||||
this.selectTag.setPath("testBean");
|
||||
@@ -243,7 +243,7 @@ public class OptionsTagTests extends AbstractHtmlElementTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withoutItemsEnumParent() throws Exception {
|
||||
void withoutItemsEnumParent() throws Exception {
|
||||
BeanWithEnum testBean = new BeanWithEnum();
|
||||
testBean.setTestEnum(TestEnum.VALUE_2);
|
||||
getPageContext().getRequest().setAttribute("testBean", testBean);
|
||||
@@ -271,7 +271,7 @@ public class OptionsTagTests extends AbstractHtmlElementTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withoutItemsEnumParentWithExplicitLabelsAndValues() throws Exception {
|
||||
void withoutItemsEnumParentWithExplicitLabelsAndValues() throws Exception {
|
||||
BeanWithEnum testBean = new BeanWithEnum();
|
||||
testBean.setTestEnum(TestEnum.VALUE_2);
|
||||
getPageContext().getRequest().setAttribute("testBean", testBean);
|
||||
@@ -305,16 +305,16 @@ public class OptionsTagTests extends AbstractHtmlElementTagTests {
|
||||
TestBean bean = new TestBean();
|
||||
bean.setName("foo");
|
||||
bean.setCountry("UK");
|
||||
bean.setMyFloat(new Float("12.34"));
|
||||
bean.setMyFloat(Float.valueOf("12.34"));
|
||||
request.setAttribute(COMMAND_NAME, bean);
|
||||
|
||||
List floats = new ArrayList();
|
||||
floats.add(new Float("12.30"));
|
||||
floats.add(new Float("12.31"));
|
||||
floats.add(new Float("12.32"));
|
||||
floats.add(new Float("12.33"));
|
||||
floats.add(new Float("12.34"));
|
||||
floats.add(new Float("12.35"));
|
||||
floats.add(Float.valueOf("12.30"));
|
||||
floats.add(Float.valueOf("12.31"));
|
||||
floats.add(Float.valueOf("12.32"));
|
||||
floats.add(Float.valueOf("12.33"));
|
||||
floats.add(Float.valueOf("12.34"));
|
||||
floats.add(Float.valueOf("12.35"));
|
||||
|
||||
request.setAttribute("floats", floats);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
@@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
|
||||
* @author Juergen Hoeller
|
||||
* @author Jeremy Grelle
|
||||
*/
|
||||
public class RadioButtonTagTests extends AbstractFormTagTests {
|
||||
class RadioButtonTagTests extends AbstractFormTagTests {
|
||||
|
||||
private RadioButtonTag tag;
|
||||
|
||||
@@ -60,7 +60,7 @@ public class RadioButtonTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withCheckedValue() throws Exception {
|
||||
void withCheckedValue() throws Exception {
|
||||
String dynamicAttribute1 = "attr1";
|
||||
String dynamicAttribute2 = "attr2";
|
||||
|
||||
@@ -84,7 +84,7 @@ public class RadioButtonTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withCheckedValueAndDynamicAttributes() throws Exception {
|
||||
void withCheckedValueAndDynamicAttributes() throws Exception {
|
||||
this.tag.setPath("sex");
|
||||
this.tag.setValue("M");
|
||||
int result = this.tag.doStartTag();
|
||||
@@ -100,7 +100,7 @@ public class RadioButtonTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withCheckedObjectValue() throws Exception {
|
||||
void withCheckedObjectValue() throws Exception {
|
||||
this.tag.setPath("myFloat");
|
||||
this.tag.setValue(getFloat());
|
||||
int result = this.tag.doStartTag();
|
||||
@@ -116,7 +116,7 @@ public class RadioButtonTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withCheckedObjectValueAndEditor() throws Exception {
|
||||
void withCheckedObjectValueAndEditor() throws Exception {
|
||||
this.tag.setPath("myFloat");
|
||||
this.tag.setValue("F12.99");
|
||||
|
||||
@@ -138,8 +138,8 @@ public class RadioButtonTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withUncheckedObjectValue() throws Exception {
|
||||
Float value = new Float("99.45");
|
||||
void withUncheckedObjectValue() throws Exception {
|
||||
Float value = Float.valueOf("99.45");
|
||||
this.tag.setPath("myFloat");
|
||||
this.tag.setValue(value);
|
||||
int result = this.tag.doStartTag();
|
||||
@@ -155,7 +155,7 @@ public class RadioButtonTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withUncheckedValue() throws Exception {
|
||||
void withUncheckedValue() throws Exception {
|
||||
this.tag.setPath("sex");
|
||||
this.tag.setValue("F");
|
||||
int result = this.tag.doStartTag();
|
||||
@@ -171,7 +171,7 @@ public class RadioButtonTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void collectionOfPets() throws Exception {
|
||||
void collectionOfPets() throws Exception {
|
||||
this.tag.setPath("pets");
|
||||
this.tag.setValue(new Pet("Rudiger"));
|
||||
|
||||
@@ -194,7 +194,7 @@ public class RadioButtonTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void collectionOfPetsNotSelected() throws Exception {
|
||||
void collectionOfPetsNotSelected() throws Exception {
|
||||
this.tag.setPath("pets");
|
||||
this.tag.setValue(new Pet("Santa's Little Helper"));
|
||||
|
||||
@@ -217,7 +217,7 @@ public class RadioButtonTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void collectionOfPetsWithEditor() throws Exception {
|
||||
void collectionOfPetsWithEditor() throws Exception {
|
||||
this.tag.setPath("pets");
|
||||
this.tag.setValue(new ItemPet("Rudiger"));
|
||||
|
||||
@@ -245,7 +245,7 @@ public class RadioButtonTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dynamicTypeAttribute() throws JspException {
|
||||
void dynamicTypeAttribute() throws JspException {
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
this.tag.setDynamicAttribute(null, "type", "email"))
|
||||
.withMessage("Attribute type=\"email\" is not allowed");
|
||||
@@ -260,7 +260,7 @@ public class RadioButtonTagTests extends AbstractFormTagTests {
|
||||
}
|
||||
|
||||
private Float getFloat() {
|
||||
return new Float("12.99");
|
||||
return Float.valueOf("12.99");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -429,9 +429,9 @@ public class SelectTagTests extends AbstractFormTagTests {
|
||||
this.tag.setPath("myFloat");
|
||||
|
||||
Float[] array = new Float[] {
|
||||
new Float("12.30"), new Float("12.32"), new Float("12.34"), new Float("12.36"),
|
||||
new Float("12.38"), new Float("12.40"), new Float("12.42"), new Float("12.44"),
|
||||
new Float("12.46"), new Float("12.48")
|
||||
Float.valueOf("12.30"), Float.valueOf("12.32"), Float.valueOf("12.34"), Float.valueOf("12.36"),
|
||||
Float.valueOf("12.38"), Float.valueOf("12.40"), Float.valueOf("12.42"), Float.valueOf("12.44"),
|
||||
Float.valueOf("12.46"), Float.valueOf("12.48")
|
||||
};
|
||||
|
||||
this.tag.setItems(array);
|
||||
@@ -1010,7 +1010,7 @@ public class SelectTagTests extends AbstractFormTagTests {
|
||||
this.bean.setName("Rob");
|
||||
this.bean.setCountry("UK");
|
||||
this.bean.setSex("M");
|
||||
this.bean.setMyFloat(new Float("12.34"));
|
||||
this.bean.setMyFloat(Float.valueOf("12.34"));
|
||||
this.bean.setSomeIntegerArray(new Integer[]{12, 34});
|
||||
return this.bean;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
@@ -26,7 +26,7 @@ class SimpleFloatEditor extends PropertyEditorSupport {
|
||||
|
||||
@Override
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
setValue(new Float(text));
|
||||
setValue(Float.valueOf(text));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -136,7 +136,7 @@ public class TextareaTagTests extends AbstractFormTagTests {
|
||||
// set up test data
|
||||
this.rob = new TestBean();
|
||||
rob.setName("Rob");
|
||||
rob.setMyFloat(new Float(12.34));
|
||||
rob.setMyFloat(12.34f);
|
||||
|
||||
TestBean sally = new TestBean();
|
||||
sally.setName("Sally");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
@@ -33,7 +33,7 @@ import org.springframework.web.testfixture.servlet.MockHttpServletResponse;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
||||
|
||||
public class RedirectViewUriTemplateTests {
|
||||
class RedirectViewUriTemplateTests {
|
||||
|
||||
private MockHttpServletRequest request;
|
||||
|
||||
@@ -48,7 +48,7 @@ public class RedirectViewUriTemplateTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void uriTemplate() throws Exception {
|
||||
void uriTemplate() throws Exception {
|
||||
Map<String, Object> model = new HashMap<>();
|
||||
model.put("foo", "bar");
|
||||
|
||||
@@ -60,7 +60,7 @@ public class RedirectViewUriTemplateTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void uriTemplateEncode() throws Exception {
|
||||
void uriTemplateEncode() throws Exception {
|
||||
Map<String, Object> model = new HashMap<>();
|
||||
model.put("foo", "bar/bar baz");
|
||||
|
||||
@@ -72,7 +72,7 @@ public class RedirectViewUriTemplateTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void uriTemplateAndArrayQueryParam() throws Exception {
|
||||
void uriTemplateAndArrayQueryParam() throws Exception {
|
||||
Map<String, Object> model = new HashMap<>();
|
||||
model.put("foo", "bar");
|
||||
model.put("fooArr", new String[] { "baz", "bazz" });
|
||||
@@ -84,9 +84,9 @@ public class RedirectViewUriTemplateTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void uriTemplateWithObjectConversion() throws Exception {
|
||||
void uriTemplateWithObjectConversion() throws Exception {
|
||||
Map<String, Object> model = new HashMap<>();
|
||||
model.put("foo", new Long(611));
|
||||
model.put("foo", 611L);
|
||||
|
||||
RedirectView redirectView = new RedirectView("/foo/{foo}");
|
||||
redirectView.renderMergedOutputModel(model, this.request, this.response);
|
||||
@@ -95,7 +95,7 @@ public class RedirectViewUriTemplateTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void uriTemplateReuseCurrentRequestVars() throws Exception {
|
||||
void uriTemplateReuseCurrentRequestVars() throws Exception {
|
||||
Map<String, Object> model = new HashMap<>();
|
||||
model.put("key1", "value1");
|
||||
model.put("name", "value2");
|
||||
@@ -115,25 +115,25 @@ public class RedirectViewUriTemplateTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void uriTemplateNullValue() throws Exception {
|
||||
void uriTemplateNullValue() throws Exception {
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
new RedirectView("/{foo}").renderMergedOutputModel(new ModelMap(), this.request, this.response));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void emptyRedirectString() throws Exception {
|
||||
void emptyRedirectString() throws Exception {
|
||||
Map<String, Object> model = new HashMap<>();
|
||||
|
||||
RedirectView redirectView = new RedirectView("");
|
||||
redirectView.renderMergedOutputModel(model, this.request, this.response);
|
||||
|
||||
assertThat(this.response.getRedirectedUrl()).isEqualTo("");
|
||||
assertThat(this.response.getRedirectedUrl()).isEmpty();
|
||||
}
|
||||
|
||||
// SPR-9016
|
||||
|
||||
@Test
|
||||
public void dontApplyUriVariables() throws Exception {
|
||||
void dontApplyUriVariables() throws Exception {
|
||||
String url = "/test#{'one','abc'}";
|
||||
RedirectView redirectView = new RedirectView(url, true);
|
||||
redirectView.setExpandUriTemplateVariables(false);
|
||||
|
||||
Reference in New Issue
Block a user