Merge branch '5.3.x'
This commit is contained in:
commit
61c3d7a989
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
|
@ -322,7 +322,7 @@ abstract class AbstractAspectJAdvisorFactoryTests {
|
|||
int b = 12;
|
||||
int c = 25;
|
||||
String d = "d";
|
||||
StringBuffer e = new StringBuffer("stringbuf");
|
||||
StringBuilder e = new StringBuilder("stringbuf");
|
||||
String expectedResult = a + b+ c + d + e;
|
||||
assertThat(mva.mungeArgs(a, b, c, d, e)).isEqualTo(expectedResult);
|
||||
}
|
||||
|
@ -728,12 +728,12 @@ abstract class AbstractAspectJAdvisorFactoryTests {
|
|||
@Aspect
|
||||
static class ManyValuedArgs {
|
||||
|
||||
String mungeArgs(String a, int b, int c, String d, StringBuffer e) {
|
||||
String mungeArgs(String a, int b, int c, String d, StringBuilder e) {
|
||||
return a + b + c + d + e;
|
||||
}
|
||||
|
||||
@Around(value="execution(String mungeArgs(..)) && args(a, b, c, d, e)", argNames="b,c,d,e,a")
|
||||
String reverseAdvice(ProceedingJoinPoint pjp, int b, int c, String d, StringBuffer e, String a) throws Throwable {
|
||||
String reverseAdvice(ProceedingJoinPoint pjp, int b, int c, String d, StringBuilder e, String a) throws Throwable {
|
||||
assertThat(pjp.proceed()).isEqualTo(a + b+ c+ d+ e);
|
||||
return a + b + c + d + e;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
|
@ -54,10 +54,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
class DirtiesContextWithContextHierarchyTests {
|
||||
|
||||
@Autowired
|
||||
private StringBuffer foo;
|
||||
private StringBuilder foo;
|
||||
|
||||
@Autowired
|
||||
private StringBuffer baz;
|
||||
private StringBuilder baz;
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
|
@ -74,7 +74,7 @@ class DirtiesContextWithContextHierarchyTests {
|
|||
@Order(1)
|
||||
void verifyOriginalStateAndDirtyContexts() {
|
||||
assertOriginalState();
|
||||
reverseStringBuffers();
|
||||
reverseStringBuilders();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -90,7 +90,7 @@ class DirtiesContextWithContextHierarchyTests {
|
|||
@DirtiesContext(hierarchyMode = HierarchyMode.CURRENT_LEVEL)
|
||||
void verifyOriginalStateWasReinstatedAndDirtyContextsAndTriggerCurrentLevelCacheClearing() {
|
||||
assertOriginalState();
|
||||
reverseStringBuffers();
|
||||
reverseStringBuilders();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -100,7 +100,7 @@ class DirtiesContextWithContextHierarchyTests {
|
|||
assertCleanChildContext();
|
||||
}
|
||||
|
||||
private void reverseStringBuffers() {
|
||||
private void reverseStringBuilders() {
|
||||
foo.reverse();
|
||||
baz.reverse();
|
||||
}
|
||||
|
@ -131,13 +131,13 @@ class DirtiesContextWithContextHierarchyTests {
|
|||
static class ParentConfig {
|
||||
|
||||
@Bean
|
||||
StringBuffer foo() {
|
||||
return new StringBuffer("foo");
|
||||
StringBuilder foo() {
|
||||
return new StringBuilder("foo");
|
||||
}
|
||||
|
||||
@Bean
|
||||
StringBuffer baz() {
|
||||
return new StringBuffer("baz-parent");
|
||||
StringBuilder baz() {
|
||||
return new StringBuilder("baz-parent");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,8 +145,8 @@ class DirtiesContextWithContextHierarchyTests {
|
|||
static class ChildConfig {
|
||||
|
||||
@Bean
|
||||
StringBuffer baz() {
|
||||
return new StringBuffer("baz-child");
|
||||
StringBuilder baz() {
|
||||
return new StringBuilder("baz-child");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
|
@ -34,62 +34,59 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
|
|||
* @author Sam Brannen
|
||||
* @since 09.04.2003
|
||||
*/
|
||||
public class RollbackRuleTests {
|
||||
class RollbackRuleTests {
|
||||
|
||||
@Test
|
||||
public void foundImmediatelyWithString() {
|
||||
RollbackRuleAttribute rr = new RollbackRuleAttribute(java.lang.Exception.class.getName());
|
||||
void foundImmediatelyWithString() {
|
||||
RollbackRuleAttribute rr = new RollbackRuleAttribute(Exception.class.getName());
|
||||
assertThat(rr.getDepth(new Exception())).isEqualTo(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void foundImmediatelyWithClass() {
|
||||
void foundImmediatelyWithClass() {
|
||||
RollbackRuleAttribute rr = new RollbackRuleAttribute(Exception.class);
|
||||
assertThat(rr.getDepth(new Exception())).isEqualTo(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void notFound() {
|
||||
void notFound() {
|
||||
RollbackRuleAttribute rr = new RollbackRuleAttribute(java.io.IOException.class.getName());
|
||||
assertThat(rr.getDepth(new MyRuntimeException(""))).isEqualTo(-1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ancestry() {
|
||||
RollbackRuleAttribute rr = new RollbackRuleAttribute(java.lang.Exception.class.getName());
|
||||
void ancestry() {
|
||||
RollbackRuleAttribute rr = new RollbackRuleAttribute(Exception.class.getName());
|
||||
// Exception -> Runtime -> NestedRuntime -> MyRuntimeException
|
||||
assertThat(rr.getDepth(new MyRuntimeException(""))).isEqualTo(3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void alwaysTrueForThrowable() {
|
||||
RollbackRuleAttribute rr = new RollbackRuleAttribute(java.lang.Throwable.class.getName());
|
||||
assertThat(rr.getDepth(new MyRuntimeException("")) > 0).isTrue();
|
||||
assertThat(rr.getDepth(new IOException()) > 0).isTrue();
|
||||
assertThat(rr.getDepth(new FatalBeanException(null,null)) > 0).isTrue();
|
||||
assertThat(rr.getDepth(new RuntimeException()) > 0).isTrue();
|
||||
void alwaysTrueForThrowable() {
|
||||
RollbackRuleAttribute rr = new RollbackRuleAttribute(Throwable.class.getName());
|
||||
assertThat(rr.getDepth(new MyRuntimeException(""))).isGreaterThan(0);
|
||||
assertThat(rr.getDepth(new IOException())).isGreaterThan(0);
|
||||
assertThat(rr.getDepth(new FatalBeanException(null, null))).isGreaterThan(0);
|
||||
assertThat(rr.getDepth(new RuntimeException())).isGreaterThan(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ctorArgMustBeAThrowableClassWithNonThrowableType() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
new RollbackRuleAttribute(StringBuffer.class));
|
||||
void ctorArgMustBeAThrowableClassWithNonThrowableType() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> new RollbackRuleAttribute(Object.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ctorArgMustBeAThrowableClassWithNullThrowableType() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
new RollbackRuleAttribute((Class<?>) null));
|
||||
void ctorArgMustBeAThrowableClassWithNullThrowableType() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> new RollbackRuleAttribute((Class<?>) null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ctorArgExceptionStringNameVersionWithNull() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
new RollbackRuleAttribute((String) null));
|
||||
void ctorArgExceptionStringNameVersionWithNull() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> new RollbackRuleAttribute((String) null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void foundEnclosedExceptionWithEnclosingException() {
|
||||
void foundEnclosedExceptionWithEnclosingException() {
|
||||
RollbackRuleAttribute rr = new RollbackRuleAttribute(EnclosingException.class);
|
||||
assertThat(rr.getDepth(new EnclosingException.EnclosedException())).isEqualTo(0);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
|
@ -57,10 +57,10 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
|||
* @since 12.08.2003
|
||||
* @see org.springframework.web.context.support.Spr8510Tests
|
||||
*/
|
||||
public class ContextLoaderTests {
|
||||
class ContextLoaderTests {
|
||||
|
||||
@Test
|
||||
public void testContextLoaderListenerWithDefaultContext() {
|
||||
void contextLoaderListenerWithDefaultContext() {
|
||||
MockServletContext sc = new MockServletContext("");
|
||||
sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
|
||||
"/org/springframework/web/context/WEB-INF/applicationContext.xml " +
|
||||
|
@ -94,8 +94,8 @@ public class ContextLoaderTests {
|
|||
* context before calling refresh in ContextLoaders</em>.
|
||||
*/
|
||||
@Test
|
||||
public void testContextLoaderListenerWithCustomizedContextLoader() {
|
||||
final StringBuffer buffer = new StringBuffer();
|
||||
void contextLoaderListenerWithCustomizedContextLoader() {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
final String expectedContents = "customizeContext() was called";
|
||||
final MockServletContext sc = new MockServletContext("");
|
||||
sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
|
||||
|
@ -106,15 +106,15 @@ public class ContextLoaderTests {
|
|||
assertThat(sc).as("The ServletContext should not be null.").isNotNull();
|
||||
assertThat(sc).as("Verifying that we received the expected ServletContext.").isEqualTo(sc);
|
||||
assertThat(wac.isActive()).as("The ApplicationContext should not yet have been refreshed.").isFalse();
|
||||
buffer.append(expectedContents);
|
||||
builder.append(expectedContents);
|
||||
}
|
||||
};
|
||||
listener.contextInitialized(new ServletContextEvent(sc));
|
||||
assertThat(buffer.toString()).as("customizeContext() should have been called.").isEqualTo(expectedContents);
|
||||
assertThat(builder.toString()).as("customizeContext() should have been called.").isEqualTo(expectedContents);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testContextLoaderListenerWithLocalContextInitializers() {
|
||||
void contextLoaderListenerWithLocalContextInitializers() {
|
||||
MockServletContext sc = new MockServletContext("");
|
||||
sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
|
||||
"org/springframework/web/context/WEB-INF/ContextLoaderTests-acc-context.xml");
|
||||
|
@ -129,7 +129,7 @@ public class ContextLoaderTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testContextLoaderListenerWithGlobalContextInitializers() {
|
||||
void contextLoaderListenerWithGlobalContextInitializers() {
|
||||
MockServletContext sc = new MockServletContext("");
|
||||
sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
|
||||
"org/springframework/web/context/WEB-INF/ContextLoaderTests-acc-context.xml");
|
||||
|
@ -144,7 +144,7 @@ public class ContextLoaderTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testContextLoaderListenerWithMixedContextInitializers() {
|
||||
void contextLoaderListenerWithMixedContextInitializers() {
|
||||
MockServletContext sc = new MockServletContext("");
|
||||
sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
|
||||
"org/springframework/web/context/WEB-INF/ContextLoaderTests-acc-context.xml");
|
||||
|
@ -159,7 +159,7 @@ public class ContextLoaderTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testContextLoaderListenerWithProgrammaticInitializers() {
|
||||
void contextLoaderListenerWithProgrammaticInitializers() {
|
||||
MockServletContext sc = new MockServletContext("");
|
||||
sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
|
||||
"org/springframework/web/context/WEB-INF/ContextLoaderTests-acc-context.xml");
|
||||
|
@ -173,7 +173,7 @@ public class ContextLoaderTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testContextLoaderListenerWithProgrammaticAndLocalInitializers() {
|
||||
void contextLoaderListenerWithProgrammaticAndLocalInitializers() {
|
||||
MockServletContext sc = new MockServletContext("");
|
||||
sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
|
||||
"org/springframework/web/context/WEB-INF/ContextLoaderTests-acc-context.xml");
|
||||
|
@ -188,7 +188,7 @@ public class ContextLoaderTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testContextLoaderListenerWithProgrammaticAndGlobalInitializers() {
|
||||
void contextLoaderListenerWithProgrammaticAndGlobalInitializers() {
|
||||
MockServletContext sc = new MockServletContext("");
|
||||
sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
|
||||
"org/springframework/web/context/WEB-INF/ContextLoaderTests-acc-context.xml");
|
||||
|
@ -203,7 +203,7 @@ public class ContextLoaderTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRegisteredContextInitializerCanAccessServletContextParamsViaEnvironment() {
|
||||
void registeredContextInitializerCanAccessServletContextParamsViaEnvironment() {
|
||||
MockServletContext sc = new MockServletContext("");
|
||||
// config file doesn't matter - just a placeholder
|
||||
sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
|
||||
|
@ -217,7 +217,7 @@ public class ContextLoaderTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testContextLoaderListenerWithUnknownContextInitializer() {
|
||||
void contextLoaderListenerWithUnknownContextInitializer() {
|
||||
MockServletContext sc = new MockServletContext("");
|
||||
// config file doesn't matter. just a placeholder
|
||||
sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
|
||||
|
@ -231,7 +231,7 @@ public class ContextLoaderTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testContextLoaderWithCustomContext() throws Exception {
|
||||
void contextLoaderWithCustomContext() throws Exception {
|
||||
MockServletContext sc = new MockServletContext("");
|
||||
sc.addInitParameter(ContextLoader.CONTEXT_CLASS_PARAM,
|
||||
"org.springframework.web.servlet.SimpleWebApplicationContext");
|
||||
|
@ -245,7 +245,7 @@ public class ContextLoaderTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testContextLoaderWithInvalidLocation() throws Exception {
|
||||
void contextLoaderWithInvalidLocation() throws Exception {
|
||||
MockServletContext sc = new MockServletContext("");
|
||||
sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM, "/WEB-INF/myContext.xml");
|
||||
ServletContextListener listener = new ContextLoaderListener();
|
||||
|
@ -256,7 +256,7 @@ public class ContextLoaderTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testContextLoaderWithInvalidContext() throws Exception {
|
||||
void contextLoaderWithInvalidContext() throws Exception {
|
||||
MockServletContext sc = new MockServletContext("");
|
||||
sc.addInitParameter(ContextLoader.CONTEXT_CLASS_PARAM,
|
||||
"org.springframework.web.context.support.InvalidWebApplicationContext");
|
||||
|
@ -268,7 +268,7 @@ public class ContextLoaderTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testContextLoaderWithDefaultLocation() throws Exception {
|
||||
void contextLoaderWithDefaultLocation() throws Exception {
|
||||
MockServletContext sc = new MockServletContext("");
|
||||
ServletContextListener listener = new ContextLoaderListener();
|
||||
ServletContextEvent event = new ServletContextEvent(sc);
|
||||
|
@ -280,7 +280,7 @@ public class ContextLoaderTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFrameworkServletWithDefaultLocation() throws Exception {
|
||||
void frameworkServletWithDefaultLocation() throws Exception {
|
||||
DispatcherServlet servlet = new DispatcherServlet();
|
||||
servlet.setContextClass(XmlWebApplicationContext.class);
|
||||
assertThatExceptionOfType(BeanDefinitionStoreException.class)
|
||||
|
@ -291,7 +291,7 @@ public class ContextLoaderTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFrameworkServletWithCustomLocation() throws Exception {
|
||||
void frameworkServletWithCustomLocation() throws Exception {
|
||||
DispatcherServlet servlet = new DispatcherServlet();
|
||||
servlet.setContextConfigLocation("/org/springframework/web/context/WEB-INF/testNamespace.xml "
|
||||
+ "/org/springframework/web/context/WEB-INF/context-addition.xml");
|
||||
|
@ -302,7 +302,7 @@ public class ContextLoaderTests {
|
|||
|
||||
@Test
|
||||
@SuppressWarnings("resource")
|
||||
public void testClassPathXmlApplicationContext() throws IOException {
|
||||
void classPathXmlApplicationContext() throws IOException {
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"/org/springframework/web/context/WEB-INF/applicationContext.xml");
|
||||
assertThat(context.containsBean("father")).as("Has father").isTrue();
|
||||
|
@ -321,7 +321,7 @@ public class ContextLoaderTests {
|
|||
|
||||
@Test
|
||||
@SuppressWarnings("resource")
|
||||
public void testSingletonDestructionOnStartupFailure() throws IOException {
|
||||
void singletonDestructionOnStartupFailure() throws IOException {
|
||||
assertThatExceptionOfType(BeanCreationException.class).isThrownBy(() ->
|
||||
new ClassPathXmlApplicationContext(new String[] {
|
||||
"/org/springframework/web/context/WEB-INF/applicationContext.xml",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
|
@ -20,7 +20,7 @@ package org.springframework.web.servlet.tags;
|
|||
* @author Juergen Hoeller
|
||||
* @since 14.01.2005
|
||||
*/
|
||||
public class HtmlEscapeTagOutsideDispatcherServletTests extends HtmlEscapeTagTests {
|
||||
class HtmlEscapeTagOutsideDispatcherServletTests extends HtmlEscapeTagTests {
|
||||
|
||||
@Override
|
||||
protected boolean inDispatcherServlet() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
|
@ -32,10 +32,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
* @author Alef Arendsen
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class HtmlEscapeTagTests extends AbstractTagTests {
|
||||
class HtmlEscapeTagTests extends AbstractTagTests {
|
||||
|
||||
@Test
|
||||
public void htmlEscapeTag() throws JspException {
|
||||
void htmlEscapeTag() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
HtmlEscapeTag tag = new HtmlEscapeTag();
|
||||
tag.setPageContext(pc);
|
||||
|
@ -87,7 +87,7 @@ public class HtmlEscapeTagTests extends AbstractTagTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void htmlEscapeTagWithContextParamTrue() throws JspException {
|
||||
void htmlEscapeTagWithContextParamTrue() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
MockServletContext sc = (MockServletContext) pc.getServletContext();
|
||||
sc.addInitParameter(WebUtils.HTML_ESCAPE_CONTEXT_PARAM, "true");
|
||||
|
@ -108,7 +108,7 @@ public class HtmlEscapeTagTests extends AbstractTagTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void htmlEscapeTagWithContextParamFalse() throws JspException {
|
||||
void htmlEscapeTagWithContextParamFalse() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
MockServletContext sc = (MockServletContext) pc.getServletContext();
|
||||
HtmlEscapeTag tag = new HtmlEscapeTag();
|
||||
|
@ -128,9 +128,9 @@ public class HtmlEscapeTagTests extends AbstractTagTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void escapeBody() throws JspException {
|
||||
void escapeBody() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
final StringBuffer result = new StringBuffer();
|
||||
final StringBuilder result = new StringBuilder();
|
||||
EscapeBodyTag tag = new EscapeBodyTag() {
|
||||
@Override
|
||||
protected String readBodyContent() {
|
||||
|
@ -148,9 +148,9 @@ public class HtmlEscapeTagTests extends AbstractTagTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void escapeBodyWithHtmlEscape() throws JspException {
|
||||
void escapeBodyWithHtmlEscape() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
final StringBuffer result = new StringBuffer();
|
||||
final StringBuilder result = new StringBuilder();
|
||||
EscapeBodyTag tag = new EscapeBodyTag() {
|
||||
@Override
|
||||
protected String readBodyContent() {
|
||||
|
@ -169,9 +169,9 @@ public class HtmlEscapeTagTests extends AbstractTagTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void escapeBodyWithJavaScriptEscape() throws JspException {
|
||||
void escapeBodyWithJavaScriptEscape() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
final StringBuffer result = new StringBuffer();
|
||||
final StringBuilder result = new StringBuilder();
|
||||
EscapeBodyTag tag = new EscapeBodyTag() {
|
||||
@Override
|
||||
protected String readBodyContent() {
|
||||
|
@ -190,9 +190,9 @@ public class HtmlEscapeTagTests extends AbstractTagTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void escapeBodyWithHtmlEscapeAndJavaScriptEscape() throws JspException {
|
||||
void escapeBodyWithHtmlEscapeAndJavaScriptEscape() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
final StringBuffer result = new StringBuffer();
|
||||
final StringBuilder result = new StringBuilder();
|
||||
EscapeBodyTag tag = new EscapeBodyTag() {
|
||||
@Override
|
||||
protected String readBodyContent() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
|
@ -20,7 +20,7 @@ package org.springframework.web.servlet.tags;
|
|||
* @author Juergen Hoeller
|
||||
* @since 14.01.2005
|
||||
*/
|
||||
public class MessageTagOutsideDispatcherServletTests extends MessageTagTests {
|
||||
class MessageTagOutsideDispatcherServletTests extends MessageTagTests {
|
||||
|
||||
@Override
|
||||
protected boolean inDispatcherServlet() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
|
@ -43,12 +43,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
* @author Nicholas Williams
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class MessageTagTests extends AbstractTagTests {
|
||||
class MessageTagTests extends AbstractTagTests {
|
||||
|
||||
@Test
|
||||
public void messageTagWithMessageSourceResolvable() throws JspException {
|
||||
void messageTagWithMessageSourceResolvable() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
final StringBuffer message = new StringBuffer();
|
||||
final StringBuilder message = new StringBuilder();
|
||||
MessageTag tag = new MessageTag() {
|
||||
@Override
|
||||
protected void writeMessage(String msg) {
|
||||
|
@ -63,9 +63,9 @@ public class MessageTagTests extends AbstractTagTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void messageTagWithCode() throws JspException {
|
||||
void messageTagWithCode() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
final StringBuffer message = new StringBuffer();
|
||||
final StringBuilder message = new StringBuilder();
|
||||
MessageTag tag = new MessageTag() {
|
||||
@Override
|
||||
protected void writeMessage(String msg) {
|
||||
|
@ -80,9 +80,9 @@ public class MessageTagTests extends AbstractTagTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void messageTagWithCodeAndArgument() throws JspException {
|
||||
void messageTagWithCodeAndArgument() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
final StringBuffer message = new StringBuffer();
|
||||
final StringBuilder message = new StringBuilder();
|
||||
MessageTag tag = new MessageTag() {
|
||||
@Override
|
||||
protected void writeMessage(String msg) {
|
||||
|
@ -98,9 +98,9 @@ public class MessageTagTests extends AbstractTagTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void messageTagWithCodeAndArguments() throws JspException {
|
||||
void messageTagWithCodeAndArguments() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
final StringBuffer message = new StringBuffer();
|
||||
final StringBuilder message = new StringBuilder();
|
||||
MessageTag tag = new MessageTag() {
|
||||
@Override
|
||||
protected void writeMessage(String msg) {
|
||||
|
@ -116,9 +116,9 @@ public class MessageTagTests extends AbstractTagTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void messageTagWithCodeAndStringArgumentWithCustomSeparator() throws JspException {
|
||||
void messageTagWithCodeAndStringArgumentWithCustomSeparator() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
final StringBuffer message = new StringBuffer();
|
||||
final StringBuilder message = new StringBuilder();
|
||||
MessageTag tag = new MessageTag() {
|
||||
@Override
|
||||
protected void writeMessage(String msg) {
|
||||
|
@ -135,9 +135,9 @@ public class MessageTagTests extends AbstractTagTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void messageTagWithCodeAndArrayArgument() throws JspException {
|
||||
void messageTagWithCodeAndArrayArgument() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
final StringBuffer message = new StringBuffer();
|
||||
final StringBuilder message = new StringBuilder();
|
||||
MessageTag tag = new MessageTag() {
|
||||
@Override
|
||||
protected void writeMessage(String msg) {
|
||||
|
@ -153,9 +153,9 @@ public class MessageTagTests extends AbstractTagTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void messageTagWithCodeAndObjectArgument() throws JspException {
|
||||
void messageTagWithCodeAndObjectArgument() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
final StringBuffer message = new StringBuffer();
|
||||
final StringBuilder message = new StringBuilder();
|
||||
MessageTag tag = new MessageTag() {
|
||||
@Override
|
||||
protected void writeMessage(String msg) {
|
||||
|
@ -171,9 +171,9 @@ public class MessageTagTests extends AbstractTagTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void messageTagWithCodeAndArgumentAndNestedArgument() throws JspException {
|
||||
void messageTagWithCodeAndArgumentAndNestedArgument() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
final StringBuffer message = new StringBuffer();
|
||||
final StringBuilder message = new StringBuilder();
|
||||
MessageTag tag = new MessageTag() {
|
||||
@Override
|
||||
protected void writeMessage(String msg) {
|
||||
|
@ -190,9 +190,9 @@ public class MessageTagTests extends AbstractTagTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void messageTagWithCodeAndNestedArgument() throws JspException {
|
||||
void messageTagWithCodeAndNestedArgument() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
final StringBuffer message = new StringBuffer();
|
||||
final StringBuilder message = new StringBuilder();
|
||||
MessageTag tag = new MessageTag() {
|
||||
@Override
|
||||
protected void writeMessage(String msg) {
|
||||
|
@ -208,9 +208,9 @@ public class MessageTagTests extends AbstractTagTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void messageTagWithCodeAndNestedArguments() throws JspException {
|
||||
void messageTagWithCodeAndNestedArguments() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
final StringBuffer message = new StringBuffer();
|
||||
final StringBuilder message = new StringBuilder();
|
||||
MessageTag tag = new MessageTag() {
|
||||
@Override
|
||||
protected void writeMessage(String msg) {
|
||||
|
@ -227,9 +227,9 @@ public class MessageTagTests extends AbstractTagTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void messageTagWithCodeAndText() throws JspException {
|
||||
void messageTagWithCodeAndText() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
final StringBuffer message = new StringBuffer();
|
||||
final StringBuilder message = new StringBuilder();
|
||||
MessageTag tag = new MessageTag() {
|
||||
@Override
|
||||
protected void writeMessage(String msg) {
|
||||
|
@ -245,9 +245,9 @@ public class MessageTagTests extends AbstractTagTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void messageTagWithText() throws JspException {
|
||||
void messageTagWithText() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
final StringBuffer message = new StringBuffer();
|
||||
final StringBuilder message = new StringBuilder();
|
||||
MessageTag tag = new MessageTag() {
|
||||
@Override
|
||||
protected void writeMessage(String msg) {
|
||||
|
@ -263,11 +263,11 @@ public class MessageTagTests extends AbstractTagTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void messageTagWithTextEncodingEscaped() throws JspException {
|
||||
void messageTagWithTextEncodingEscaped() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
pc.getServletContext().setInitParameter(WebUtils.RESPONSE_ENCODED_HTML_ESCAPE_CONTEXT_PARAM, "true");
|
||||
pc.getResponse().setCharacterEncoding("UTF-8");
|
||||
final StringBuffer message = new StringBuffer();
|
||||
final StringBuilder message = new StringBuilder();
|
||||
MessageTag tag = new MessageTag() {
|
||||
@Override
|
||||
protected void writeMessage(String msg) {
|
||||
|
@ -283,9 +283,9 @@ public class MessageTagTests extends AbstractTagTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void messageTagWithTextAndJavaScriptEscape() throws JspException {
|
||||
void messageTagWithTextAndJavaScriptEscape() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
final StringBuffer message = new StringBuffer();
|
||||
final StringBuilder message = new StringBuilder();
|
||||
MessageTag tag = new MessageTag() {
|
||||
@Override
|
||||
protected void writeMessage(String msg) {
|
||||
|
@ -301,9 +301,9 @@ public class MessageTagTests extends AbstractTagTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void messageTagWithTextAndHtmlEscapeAndJavaScriptEscape() throws JspException {
|
||||
void messageTagWithTextAndHtmlEscapeAndJavaScriptEscape() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
final StringBuffer message = new StringBuffer();
|
||||
final StringBuilder message = new StringBuilder();
|
||||
MessageTag tag = new MessageTag() {
|
||||
@Override
|
||||
protected void writeMessage(String msg) {
|
||||
|
@ -320,7 +320,7 @@ public class MessageTagTests extends AbstractTagTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void messageWithVarAndScope() throws JspException {
|
||||
void messageWithVarAndScope() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
MessageTag tag = new MessageTag();
|
||||
tag.setPageContext(pc);
|
||||
|
@ -343,7 +343,7 @@ public class MessageTagTests extends AbstractTagTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void messageWithVar() throws JspException {
|
||||
void messageWithVar() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
MessageTag tag = new MessageTag();
|
||||
tag.setPageContext(pc);
|
||||
|
@ -365,7 +365,7 @@ public class MessageTagTests extends AbstractTagTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void nullMessageSource() throws JspException {
|
||||
void nullMessageSource() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
ConfigurableWebApplicationContext ctx = (ConfigurableWebApplicationContext)
|
||||
RequestContextUtils.findWebApplicationContext((HttpServletRequest) pc.getRequest(), pc.getServletContext());
|
||||
|
@ -381,7 +381,7 @@ public class MessageTagTests extends AbstractTagTests {
|
|||
|
||||
@Test
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void requestContext() throws ServletException {
|
||||
void requestContext() throws ServletException {
|
||||
PageContext pc = createPageContext();
|
||||
RequestContext rc = new RequestContext((HttpServletRequest) pc.getRequest(), pc.getServletContext());
|
||||
assertThat(rc.getMessage("test")).isEqualTo("test message");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
|
@ -36,13 +36,13 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
* @author Juergen Hoeller
|
||||
* @author Alef Arendsen
|
||||
*/
|
||||
public class ThemeTagTests extends AbstractTagTests {
|
||||
class ThemeTagTests extends AbstractTagTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("serial")
|
||||
public void themeTag() throws JspException {
|
||||
void themeTag() throws JspException {
|
||||
PageContext pc = createPageContext();
|
||||
final StringBuffer message = new StringBuffer();
|
||||
final StringBuilder message = new StringBuilder();
|
||||
ThemeTag tag = new ThemeTag() {
|
||||
@Override
|
||||
protected void writeMessage(String msg) {
|
||||
|
@ -58,7 +58,7 @@ public class ThemeTagTests extends AbstractTagTests {
|
|||
|
||||
@Test
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void requestContext() throws ServletException {
|
||||
void requestContext() throws ServletException {
|
||||
PageContext pc = createPageContext();
|
||||
RequestContext rc = new RequestContext((HttpServletRequest) pc.getRequest());
|
||||
assertThat(rc.getThemeMessage("themetest")).isEqualTo("theme test message");
|
||||
|
|
Loading…
Reference in New Issue