mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Clean up AssertJ usage after migration
- Avoid the use of assertThat(Arrays.equals(...))
- Convert assertThat(Boolean.FALSE).isEqualTo(x) to assertThat(x).isEqualTo(Boolean.FALSE)
- Convert assertThat(Boolean.TRUE).isEqualTo(x) to assertThat(x).isEqualTo(Boolean.TRUE)
- Convert assertThat(x.equals(y)).isTrue() to assertThat(x).isEqualTo(y)
- Convert assertThat(x.equals(y)).isFalse() to assertThat(x).isNotEqualTo(y)
- Remove unnecessary parentheses in assertThat() arguments
- Convert assertThat(x instanceof X).isFalse() to assertThat(x).isNotInstanceOf()
- Convert assertThat(x instanceof X).isTrue() to assertThat(x).isInstanceOf()
- Convert assertThat(!x).isTrue() to assertThat(x).isFalse()
- Inline conditions in assertThat() statements
Closes gh-36504
(cherry picked from commit e1e4d52b61)
This commit is contained in:
@@ -70,16 +70,14 @@ class ContextLoaderTests {
|
||||
listener.contextInitialized(event);
|
||||
String contextAttr = WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE;
|
||||
WebApplicationContext context = (WebApplicationContext) sc.getAttribute(contextAttr);
|
||||
boolean condition1 = context instanceof XmlWebApplicationContext;
|
||||
assertThat(condition1).as("Correct WebApplicationContext exposed in ServletContext").isTrue();
|
||||
assertThat(context).as("Correct WebApplicationContext exposed in ServletContext").isInstanceOf(XmlWebApplicationContext.class);
|
||||
assertThat(WebApplicationContextUtils.getRequiredWebApplicationContext(sc)).isInstanceOf(
|
||||
XmlWebApplicationContext.class);
|
||||
LifecycleBean lb = (LifecycleBean) context.getBean("lifecycle");
|
||||
assertThat(context.containsBean("father")).as("Has father").isTrue();
|
||||
assertThat(context.containsBean("rod")).as("Has rod").isTrue();
|
||||
assertThat(context.containsBean("kerry")).as("Has kerry").isTrue();
|
||||
boolean condition = !lb.isDestroyed();
|
||||
assertThat(condition).as("Not destroyed").isTrue();
|
||||
assertThat(lb.isDestroyed()).as("Not destroyed").isFalse();
|
||||
assertThat(context.containsBean("beans1.bean1")).isFalse();
|
||||
assertThat(context.containsBean("beans1.bean2")).isFalse();
|
||||
listener.contextDestroyed(event);
|
||||
@@ -241,8 +239,7 @@ class ContextLoaderTests {
|
||||
listener.contextInitialized(event);
|
||||
String contextAttr = WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE;
|
||||
WebApplicationContext wc = (WebApplicationContext) sc.getAttribute(contextAttr);
|
||||
boolean condition = wc instanceof SimpleWebApplicationContext;
|
||||
assertThat(condition).as("Correct WebApplicationContext exposed in ServletContext").isTrue();
|
||||
assertThat(wc).as("Correct WebApplicationContext exposed in ServletContext").isInstanceOf(SimpleWebApplicationContext.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+2
-2
@@ -135,9 +135,9 @@ class XmlWebApplicationContextTests extends AbstractApplicationContextTests {
|
||||
InitAndIB iib = (InitAndIB) this.applicationContext.getBean("init-and-ib");
|
||||
assertThat(InitAndIB.constructed).isTrue();
|
||||
assertThat(iib.afterPropertiesSetInvoked && iib.initMethodInvoked).isTrue();
|
||||
assertThat(!iib.destroyed && !iib.customDestroyed).isTrue();
|
||||
assertThat(iib.destroyed && !iib.customDestroyed).isFalse();
|
||||
this.applicationContext.close();
|
||||
assertThat(!iib.destroyed && !iib.customDestroyed).isTrue();
|
||||
assertThat(iib.destroyed && !iib.customDestroyed).isFalse();
|
||||
ConfigurableApplicationContext parent = (ConfigurableApplicationContext) this.applicationContext.getParent();
|
||||
parent.close();
|
||||
assertThat(iib.destroyed && iib.customDestroyed).isTrue();
|
||||
|
||||
+6
-6
@@ -121,15 +121,15 @@ class DispatcherServletTests {
|
||||
|
||||
@Test
|
||||
void configuredDispatcherServlets() {
|
||||
assertThat((simpleDispatcherServlet.getNamespace())).as("Correct namespace")
|
||||
assertThat(simpleDispatcherServlet.getNamespace()).as("Correct namespace")
|
||||
.isEqualTo("simple" + FrameworkServlet.DEFAULT_NAMESPACE_SUFFIX);
|
||||
assertThat((FrameworkServlet.SERVLET_CONTEXT_PREFIX + "simple")).as("Correct attribute")
|
||||
assertThat(FrameworkServlet.SERVLET_CONTEXT_PREFIX + "simple").as("Correct attribute")
|
||||
.isEqualTo(simpleDispatcherServlet.getServletContextAttributeName());
|
||||
assertThat(simpleDispatcherServlet.getWebApplicationContext()).as("Context published")
|
||||
.isSameAs(getServletContext().getAttribute(FrameworkServlet.SERVLET_CONTEXT_PREFIX + "simple"));
|
||||
|
||||
assertThat(complexDispatcherServlet.getNamespace()).as("Correct namespace").isEqualTo("test");
|
||||
assertThat((FrameworkServlet.SERVLET_CONTEXT_PREFIX + "complex")).as("Correct attribute")
|
||||
assertThat(FrameworkServlet.SERVLET_CONTEXT_PREFIX + "complex").as("Correct attribute")
|
||||
.isEqualTo(complexDispatcherServlet.getServletContextAttributeName());
|
||||
assertThat(getServletContext().getAttribute(FrameworkServlet.SERVLET_CONTEXT_PREFIX + "complex")).as("Context not published")
|
||||
.isNull();
|
||||
@@ -205,7 +205,7 @@ class DispatcherServletTests {
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
complexDispatcherServlet.service(request, response);
|
||||
assertThat(response.getForwardedUrl()).as("forwarded URL").isEqualTo("failed0.jsp");
|
||||
assertThat(request.getAttribute("exception").getClass().equals(ServletException.class)).as("Exception exposed").isTrue();
|
||||
assertThat(request.getAttribute("exception").getClass()).as("Exception exposed").isEqualTo(ServletException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -368,7 +368,7 @@ class DispatcherServletTests {
|
||||
complexDispatcherServlet.service(request, response);
|
||||
assertThat(response.getStatus()).isEqualTo(200);
|
||||
assertThat(response.getForwardedUrl()).as("forwarded URL").isEqualTo("failed0.jsp");
|
||||
assertThat(request.getAttribute("exception").getClass().equals(RuntimeException.class)).as("Exception exposed").isTrue();
|
||||
assertThat(request.getAttribute("exception").getClass()).as("Exception exposed").isEqualTo(RuntimeException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -381,7 +381,7 @@ class DispatcherServletTests {
|
||||
complexDispatcherServlet.service(request, response);
|
||||
assertThat(response.getStatus()).isEqualTo(200);
|
||||
assertThat(response.getForwardedUrl()).as("forwarded URL").isEqualTo("failed0.jsp");
|
||||
assertThat(request.getAttribute("exception").getClass().equals(ServletException.class)).as("Exception exposed").isTrue();
|
||||
assertThat(request.getAttribute("exception").getClass()).as("Exception exposed").isEqualTo(ServletException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+4
-8
@@ -111,8 +111,7 @@ class DelegatingWebMvcConfigurationTests {
|
||||
|
||||
assertThat(initializer).isNotNull();
|
||||
assertThat(initializer.getConversionService()).isSameAs(conversionService.getValue());
|
||||
boolean condition = initializer.getValidator() instanceof LocalValidatorFactoryBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(initializer.getValidator()).isInstanceOf(LocalValidatorFactoryBean.class);
|
||||
assertThat(resolvers.getValue()).isEmpty();
|
||||
assertThat(handlers.getValue()).isEmpty();
|
||||
assertThat(adapter.getMessageConverters()).isEqualTo(converters.getValue());
|
||||
@@ -176,12 +175,9 @@ class DelegatingWebMvcConfigurationTests {
|
||||
verify(webMvcConfigurer).configureHandlerExceptionResolvers(exceptionResolvers.capture());
|
||||
|
||||
assertThat(exceptionResolvers.getValue()).hasSize(3);
|
||||
boolean condition2 = exceptionResolvers.getValue().get(0) instanceof ExceptionHandlerExceptionResolver;
|
||||
assertThat(condition2).isTrue();
|
||||
boolean condition1 = exceptionResolvers.getValue().get(1) instanceof ResponseStatusExceptionResolver;
|
||||
assertThat(condition1).isTrue();
|
||||
boolean condition = exceptionResolvers.getValue().get(2) instanceof DefaultHandlerExceptionResolver;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(exceptionResolvers.getValue().get(0)).isInstanceOf(ExceptionHandlerExceptionResolver.class);
|
||||
assertThat(exceptionResolvers.getValue().get(1)).isInstanceOf(ResponseStatusExceptionResolver.class);
|
||||
assertThat(exceptionResolvers.getValue().get(2)).isInstanceOf(DefaultHandlerExceptionResolver.class);
|
||||
assertThat(converters.getValue()).isNotEmpty();
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -200,8 +200,7 @@ class InterceptorRegistryTests {
|
||||
private void verifyWebInterceptor(HandlerInterceptor interceptor,
|
||||
TestWebRequestInterceptor webInterceptor) throws Exception {
|
||||
|
||||
boolean condition = interceptor instanceof WebRequestHandlerInterceptorAdapter;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(interceptor).isInstanceOf(WebRequestHandlerInterceptorAdapter.class);
|
||||
interceptor.preHandle(this.request, this.response, null);
|
||||
assertThat(webInterceptor.preHandleInvoked).isTrue();
|
||||
}
|
||||
|
||||
+2
-4
@@ -192,13 +192,11 @@ class WebMvcConfigurationSupportTests {
|
||||
|
||||
ConversionService conversionService = initializer.getConversionService();
|
||||
assertThat(conversionService).isNotNull();
|
||||
boolean condition1 = conversionService instanceof FormattingConversionService;
|
||||
assertThat(condition1).isTrue();
|
||||
assertThat(conversionService).isInstanceOf(FormattingConversionService.class);
|
||||
|
||||
Validator validator = initializer.getValidator();
|
||||
assertThat(validator).isNotNull();
|
||||
boolean condition = validator instanceof LocalValidatorFactoryBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(validator).isInstanceOf(LocalValidatorFactoryBean.class);
|
||||
|
||||
DirectFieldAccessor fieldAccessor = new DirectFieldAccessor(adapter);
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
+3
-6
@@ -93,8 +93,7 @@ class LocaleResolverTests {
|
||||
else {
|
||||
assertThat(localeContext.getLocale()).isEqualTo(Locale.UK);
|
||||
}
|
||||
boolean condition2 = localeContext instanceof TimeZoneAwareLocaleContext;
|
||||
assertThat(condition2).isTrue();
|
||||
assertThat(localeContext).isInstanceOf(TimeZoneAwareLocaleContext.class);
|
||||
assertThat(((TimeZoneAwareLocaleContext) localeContext).getTimeZone()).isNull();
|
||||
|
||||
if (localeContextResolver instanceof AbstractLocaleContextResolver) {
|
||||
@@ -122,16 +121,14 @@ class LocaleResolverTests {
|
||||
new SimpleTimeZoneAwareLocaleContext(Locale.GERMANY, TimeZone.getTimeZone("GMT+2")));
|
||||
localeContext = localeContextResolver.resolveLocaleContext(request);
|
||||
assertThat(localeContext.getLocale()).isEqualTo(Locale.GERMANY);
|
||||
boolean condition1 = localeContext instanceof TimeZoneAwareLocaleContext;
|
||||
assertThat(condition1).isTrue();
|
||||
assertThat(localeContext).isInstanceOf(TimeZoneAwareLocaleContext.class);
|
||||
assertThat(TimeZone.getTimeZone("GMT+2")).isEqualTo(((TimeZoneAwareLocaleContext) localeContext).getTimeZone());
|
||||
|
||||
localeContextResolver.setLocaleContext(request, response,
|
||||
new SimpleTimeZoneAwareLocaleContext(null, TimeZone.getTimeZone("GMT+3")));
|
||||
localeContext = localeContextResolver.resolveLocaleContext(request);
|
||||
assertThat(localeContext.getLocale()).isEqualTo(Locale.UK);
|
||||
boolean condition = localeContext instanceof TimeZoneAwareLocaleContext;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(localeContext).isInstanceOf(TimeZoneAwareLocaleContext.class);
|
||||
assertThat(TimeZone.getTimeZone("GMT+3")).isEqualTo(((TimeZoneAwareLocaleContext) localeContext).getTimeZone());
|
||||
|
||||
if (localeContextResolver instanceof AbstractLocaleContextResolver) {
|
||||
|
||||
+1
-5
@@ -16,11 +16,8 @@
|
||||
|
||||
package org.springframework.web.servlet.mvc.condition;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.web.servlet.mvc.condition.HeadersRequestCondition.HeaderExpression;
|
||||
import org.springframework.web.testfixture.servlet.MockHttpServletRequest;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -160,8 +157,7 @@ class HeadersRequestConditionTests {
|
||||
HeadersRequestCondition condition2 = new HeadersRequestCondition("foo=baz");
|
||||
|
||||
HeadersRequestCondition result = condition1.combine(condition2);
|
||||
Collection<HeaderExpression> conditions = result.getContent();
|
||||
assertThat(conditions).hasSize(2);
|
||||
assertThat(result.getContent()).hasSize(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+1
-5
@@ -16,11 +16,8 @@
|
||||
|
||||
package org.springframework.web.servlet.mvc.condition;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.web.servlet.mvc.condition.ParamsRequestCondition.ParamExpression;
|
||||
import org.springframework.web.testfixture.servlet.MockHttpServletRequest;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -149,8 +146,7 @@ class ParamsRequestConditionTests {
|
||||
ParamsRequestCondition condition2 = new ParamsRequestCondition("foo=baz");
|
||||
|
||||
ParamsRequestCondition result = condition1.combine(condition2);
|
||||
Collection<ParamExpression> conditions = result.getContent();
|
||||
assertThat(conditions).hasSize(2);
|
||||
assertThat(result.getContent()).hasSize(2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -128,7 +128,7 @@ public abstract class AbstractRequestAttributesArgumentResolverTests {
|
||||
Object actual = testResolveArgument(param, factory);
|
||||
assertThat(actual).isNotNull();
|
||||
assertThat(actual.getClass()).isEqualTo(Optional.class);
|
||||
assertThat(((Optional<?>) actual)).isNotPresent();
|
||||
assertThat((Optional<?>) actual).isNotPresent();
|
||||
|
||||
Foo foo = new Foo();
|
||||
this.webRequest.setAttribute("foo", foo, getScope());
|
||||
@@ -136,7 +136,7 @@ public abstract class AbstractRequestAttributesArgumentResolverTests {
|
||||
actual = testResolveArgument(param, factory);
|
||||
assertThat(actual).isNotNull();
|
||||
assertThat(actual.getClass()).isEqualTo(Optional.class);
|
||||
assertThat(((Optional<?>) actual)).isPresent();
|
||||
assertThat((Optional<?>) actual).isPresent();
|
||||
assertThat(((Optional<?>) actual).get()).isSameAs(foo);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -826,7 +826,7 @@ class HttpEntityMethodProcessorMockTests {
|
||||
}
|
||||
if (lastModified != -1) {
|
||||
assertThat(servletResponse.getHeaderValues(HttpHeaders.LAST_MODIFIED)).hasSize(1);
|
||||
assertThat((servletResponse.getDateHeader(HttpHeaders.LAST_MODIFIED) / 1000)).isEqualTo((lastModified / 1000));
|
||||
assertThat(servletResponse.getDateHeader(HttpHeaders.LAST_MODIFIED) / 1000).isEqualTo((lastModified / 1000));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-6
@@ -396,8 +396,7 @@ class RequestPartMethodArgumentResolverTests {
|
||||
webRequest = new ServletWebRequest(request);
|
||||
|
||||
Object actualValue = resolver.resolveArgument(optionalMultipartFileList, null, webRequest, null);
|
||||
boolean condition1 = actualValue instanceof Optional;
|
||||
assertThat(condition1).isTrue();
|
||||
assertThat(actualValue).isInstanceOf(Optional.class);
|
||||
assertThat(((Optional<?>) actualValue).get()).as("Invalid result").isEqualTo(Collections.singletonList(expected));
|
||||
|
||||
actualValue = resolver.resolveArgument(optionalMultipartFileList, null, webRequest, null);
|
||||
@@ -439,8 +438,7 @@ class RequestPartMethodArgumentResolverTests {
|
||||
webRequest = new ServletWebRequest(request);
|
||||
|
||||
Object actualValue = resolver.resolveArgument(optionalPart, null, webRequest, null);
|
||||
boolean condition1 = actualValue instanceof Optional;
|
||||
assertThat(condition1).isTrue();
|
||||
assertThat(actualValue).isInstanceOf(Optional.class);
|
||||
assertThat(((Optional<?>) actualValue).get()).as("Invalid result").isEqualTo(expected);
|
||||
|
||||
actualValue = resolver.resolveArgument(optionalPart, null, webRequest, null);
|
||||
@@ -484,8 +482,7 @@ class RequestPartMethodArgumentResolverTests {
|
||||
webRequest = new ServletWebRequest(request);
|
||||
|
||||
Object actualValue = resolver.resolveArgument(optionalPartList, null, webRequest, null);
|
||||
boolean condition1 = actualValue instanceof Optional;
|
||||
assertThat(condition1).isTrue();
|
||||
assertThat(actualValue).isInstanceOf(Optional.class);
|
||||
assertThat(((Optional<?>) actualValue).get()).as("Invalid result").isEqualTo(Collections.singletonList(expected));
|
||||
|
||||
actualValue = resolver.resolveArgument(optionalPartList, null, webRequest, null);
|
||||
|
||||
+2
-4
@@ -399,10 +399,8 @@ class ResponseEntityExceptionHandlerTests {
|
||||
servlet.service(this.servletRequest, this.servletResponse);
|
||||
}
|
||||
catch (ServletException ex) {
|
||||
boolean condition1 = ex.getCause() instanceof IllegalStateException;
|
||||
assertThat(condition1).isTrue();
|
||||
boolean condition = ex.getCause().getCause() instanceof ServletRequestBindingException;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(ex.getCause()).isInstanceOf(IllegalStateException.class);
|
||||
assertThat(ex.getCause().getCause()).isInstanceOf(ServletRequestBindingException.class);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+21
-22
@@ -401,8 +401,8 @@ class ServletAnnotationControllerHandlerMethodTests extends AbstractServletHandl
|
||||
assertThat(session).isNotNull();
|
||||
assertThat(session.getAttribute("object1")).isNotNull();
|
||||
assertThat(session.getAttribute("object2")).isNotNull();
|
||||
assertThat(((Map) session.getAttribute("model"))).containsKey("object1");
|
||||
assertThat(((Map) session.getAttribute("model"))).containsKey("object2");
|
||||
assertThat((Map) session.getAttribute("model")).containsKey("object1");
|
||||
assertThat((Map) session.getAttribute("model")).containsKey("object2");
|
||||
|
||||
request = new MockHttpServletRequest("POST", "/myPage");
|
||||
request.setSession(session);
|
||||
@@ -411,8 +411,8 @@ class ServletAnnotationControllerHandlerMethodTests extends AbstractServletHandl
|
||||
assertThat(request.getAttribute("viewName")).isEqualTo("page2");
|
||||
assertThat(session.getAttribute("object1")).isNotNull();
|
||||
assertThat(session.getAttribute("object2")).isNotNull();
|
||||
assertThat(((Map) session.getAttribute("model"))).containsKey("object1");
|
||||
assertThat(((Map) session.getAttribute("model"))).containsKey("object2");
|
||||
assertThat((Map) session.getAttribute("model")).containsKey("object1");
|
||||
assertThat((Map) session.getAttribute("model")).containsKey("object2");
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@@ -434,8 +434,8 @@ class ServletAnnotationControllerHandlerMethodTests extends AbstractServletHandl
|
||||
assertThat(session).isNotNull();
|
||||
assertThat(session.getAttribute("object1")).isNotNull();
|
||||
assertThat(session.getAttribute("object2")).isNotNull();
|
||||
assertThat(((Map) session.getAttribute("model"))).containsKey("object1");
|
||||
assertThat(((Map) session.getAttribute("model"))).containsKey("object2");
|
||||
assertThat((Map) session.getAttribute("model")).containsKey("object1");
|
||||
assertThat((Map) session.getAttribute("model")).containsKey("object2");
|
||||
|
||||
request = new MockHttpServletRequest("POST", "/myPage");
|
||||
request.setSession(session);
|
||||
@@ -444,8 +444,8 @@ class ServletAnnotationControllerHandlerMethodTests extends AbstractServletHandl
|
||||
assertThat(request.getAttribute("viewName")).isEqualTo("page2");
|
||||
assertThat(session.getAttribute("object1")).isNotNull();
|
||||
assertThat(session.getAttribute("object2")).isNotNull();
|
||||
assertThat(((Map) session.getAttribute("model"))).containsKey("object1");
|
||||
assertThat(((Map) session.getAttribute("model"))).containsKey("object2");
|
||||
assertThat((Map) session.getAttribute("model")).containsKey("object1");
|
||||
assertThat((Map) session.getAttribute("model")).containsKey("object2");
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@@ -464,9 +464,9 @@ class ServletAnnotationControllerHandlerMethodTests extends AbstractServletHandl
|
||||
assertThat(session).isNotNull();
|
||||
assertThat(session.getAttribute("object1")).isNotNull();
|
||||
assertThat(session.getAttribute("object2")).isNotNull();
|
||||
assertThat(((Map) session.getAttribute("model"))).containsKey("object1");
|
||||
assertThat(((Map) session.getAttribute("model"))).containsKey("object2");
|
||||
assertThat(((Map) session.getAttribute("model"))).containsKey("testBeanList");
|
||||
assertThat((Map) session.getAttribute("model")).containsKey("object1");
|
||||
assertThat((Map) session.getAttribute("model")).containsKey("object2");
|
||||
assertThat((Map) session.getAttribute("model")).containsKey("testBeanList");
|
||||
|
||||
request = new MockHttpServletRequest("POST", "/myPage");
|
||||
request.setSession(session);
|
||||
@@ -475,9 +475,9 @@ class ServletAnnotationControllerHandlerMethodTests extends AbstractServletHandl
|
||||
assertThat(request.getAttribute("viewName")).isEqualTo("page2");
|
||||
assertThat(session.getAttribute("object1")).isNotNull();
|
||||
assertThat(session.getAttribute("object2")).isNotNull();
|
||||
assertThat(((Map) session.getAttribute("model"))).containsKey("object1");
|
||||
assertThat(((Map) session.getAttribute("model"))).containsKey("object2");
|
||||
assertThat(((Map) session.getAttribute("model"))).containsKey("testBeanList");
|
||||
assertThat((Map) session.getAttribute("model")).containsKey("object1");
|
||||
assertThat((Map) session.getAttribute("model")).containsKey("object2");
|
||||
assertThat((Map) session.getAttribute("model")).containsKey("testBeanList");
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@@ -496,9 +496,9 @@ class ServletAnnotationControllerHandlerMethodTests extends AbstractServletHandl
|
||||
assertThat(session).isNotNull();
|
||||
assertThat(session.getAttribute("object1")).isNotNull();
|
||||
assertThat(session.getAttribute("object2")).isNotNull();
|
||||
assertThat(((Map) session.getAttribute("model"))).containsKey("object1");
|
||||
assertThat(((Map) session.getAttribute("model"))).containsKey("object2");
|
||||
assertThat(((Map) session.getAttribute("model"))).containsKey("testBeanList");
|
||||
assertThat((Map) session.getAttribute("model")).containsKey("object1");
|
||||
assertThat((Map) session.getAttribute("model")).containsKey("object2");
|
||||
assertThat((Map) session.getAttribute("model")).containsKey("testBeanList");
|
||||
|
||||
request = new MockHttpServletRequest("POST", "/myPage");
|
||||
request.setSession(session);
|
||||
@@ -507,9 +507,9 @@ class ServletAnnotationControllerHandlerMethodTests extends AbstractServletHandl
|
||||
assertThat(request.getAttribute("viewName")).isEqualTo("page2");
|
||||
assertThat(session.getAttribute("object1")).isNotNull();
|
||||
assertThat(session.getAttribute("object2")).isNotNull();
|
||||
assertThat(((Map) session.getAttribute("model"))).containsKey("object1");
|
||||
assertThat(((Map) session.getAttribute("model"))).containsKey("object2");
|
||||
assertThat(((Map) session.getAttribute("model"))).containsKey("testBeanList");
|
||||
assertThat((Map) session.getAttribute("model")).containsKey("object1");
|
||||
assertThat((Map) session.getAttribute("model")).containsKey("object2");
|
||||
assertThat((Map) session.getAttribute("model")).containsKey("testBeanList");
|
||||
}
|
||||
|
||||
@PathPatternsParameterizedTest
|
||||
@@ -2799,8 +2799,7 @@ class ServletAnnotationControllerHandlerMethodTests extends AbstractServletHandl
|
||||
public String myOtherHandle(TB tb, BindingResult errors, ExtendedModelMap model, MySpecialArg arg) {
|
||||
TestBean tbReal = (TestBean) tb;
|
||||
tbReal.setName("myName");
|
||||
boolean condition = model.get("ITestBean") instanceof DerivedTestBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(model.get("ITestBean")).isInstanceOf(DerivedTestBean.class);
|
||||
assertThat(arg).isNotNull();
|
||||
return super.myHandle(tbReal, errors, model);
|
||||
}
|
||||
|
||||
+4
-8
@@ -78,8 +78,7 @@ class EncodedResourceResolverTests {
|
||||
assertThat(actual.getDescription()).isEqualTo(getResource(file + ".gz").getDescription());
|
||||
assertThat(actual.getFilename()).isEqualTo(getResource(file).getFilename());
|
||||
|
||||
boolean condition = actual instanceof HttpResource;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(actual).isInstanceOf(HttpResource.class);
|
||||
HttpHeaders headers = ((HttpResource) actual).getResponseHeaders();
|
||||
assertThat(headers.getFirst(HttpHeaders.CONTENT_ENCODING)).isEqualTo("gzip");
|
||||
assertThat(headers.getFirst(HttpHeaders.VARY)).isEqualTo("Accept-Encoding");
|
||||
@@ -95,8 +94,7 @@ class EncodedResourceResolverTests {
|
||||
|
||||
assertThat(resolved.getDescription()).isEqualTo(getResource("foo.css.gz").getDescription());
|
||||
assertThat(resolved.getFilename()).isEqualTo(getResource("foo.css").getFilename());
|
||||
boolean condition = resolved instanceof HttpResource;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(resolved).isInstanceOf(HttpResource.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -110,8 +108,7 @@ class EncodedResourceResolverTests {
|
||||
|
||||
assertThat(resolved.getDescription()).isEqualTo(getResource(file + ".gz").getDescription());
|
||||
assertThat(resolved.getFilename()).isEqualTo(getResource(file).getFilename());
|
||||
boolean condition = resolved instanceof HttpResource;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(resolved).isInstanceOf(HttpResource.class);
|
||||
|
||||
// 2. Resolve unencoded resource
|
||||
request = new MockHttpServletRequest("GET", "/js/foo.js");
|
||||
@@ -119,8 +116,7 @@ class EncodedResourceResolverTests {
|
||||
|
||||
assertThat(resolved.getDescription()).isEqualTo(getResource(file).getDescription());
|
||||
assertThat(resolved.getFilename()).isEqualTo(getResource(file).getFilename());
|
||||
boolean condition1 = resolved instanceof HttpResource;
|
||||
assertThat(condition1).isFalse();
|
||||
assertThat(resolved).isNotInstanceOf(HttpResource.class);
|
||||
}
|
||||
|
||||
@Test // SPR-13149
|
||||
|
||||
+2
-4
@@ -92,8 +92,7 @@ class AnnotationConfigDispatcherServletInitializerTests {
|
||||
((AnnotationConfigWebApplicationContext) wac).refresh();
|
||||
|
||||
assertThat(wac.containsBean("bean")).isTrue();
|
||||
boolean condition = wac.getBean("bean") instanceof MyBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(wac.getBean("bean")).isInstanceOf(MyBean.class);
|
||||
|
||||
assertThat(servletRegistrations).hasSize(1);
|
||||
assertThat(servletRegistrations.get(SERVLET_NAME)).isNotNull();
|
||||
@@ -161,8 +160,7 @@ class AnnotationConfigDispatcherServletInitializerTests {
|
||||
((AnnotationConfigWebApplicationContext) wac).refresh();
|
||||
|
||||
assertThat(wac.containsBean("bean")).isTrue();
|
||||
boolean condition = wac.getBean("bean") instanceof MyBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(wac.getBean("bean")).isInstanceOf(MyBean.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+1
-2
@@ -67,8 +67,7 @@ class DispatcherServletInitializerTests {
|
||||
WebApplicationContext servletContext = servlet.getWebApplicationContext();
|
||||
|
||||
assertThat(servletContext.containsBean("bean")).isTrue();
|
||||
boolean condition = servletContext.getBean("bean") instanceof MyBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(servletContext.getBean("bean")).isInstanceOf(MyBean.class);
|
||||
|
||||
assertThat(registrations).hasSize(1);
|
||||
assertThat(registrations.get(SERVLET_NAME)).isNotNull();
|
||||
|
||||
@@ -65,8 +65,7 @@ class BindTagTests extends AbstractTagTests {
|
||||
assertThat(status.getExpression()).as("Correct expression").isNull();
|
||||
assertThat(status.getValue()).as("Correct value").isNull();
|
||||
assertThat(status.getDisplayValue()).as("Correct displayValue").isEmpty();
|
||||
boolean condition = !status.isError();
|
||||
assertThat(condition).as("Correct isError").isTrue();
|
||||
assertThat(status.isError()).as("Correct isError").isFalse();
|
||||
assertThat(status.getErrorCodes()).as("Correct errorCodes").isEmpty();
|
||||
assertThat(status.getErrorMessages()).as("Correct errorMessages").isEmpty();
|
||||
assertThat(status.getErrorCode()).as("Correct errorCode").isEmpty();
|
||||
@@ -480,8 +479,7 @@ class BindTagTests extends AbstractTagTests {
|
||||
BindStatus status = (BindStatus) pc.getAttribute(BindTag.STATUS_VARIABLE_NAME, PageContext.REQUEST_SCOPE);
|
||||
assertThat(status).as("Has status variable").isNotNull();
|
||||
assertThat(status.getExpression()).as("Correct expression").isEqualTo("array[0]");
|
||||
boolean condition = status.getValue() instanceof TestBean;
|
||||
assertThat(condition).as("Value is TestBean").isTrue();
|
||||
assertThat(status.getValue()).as("Value is TestBean").isInstanceOf(TestBean.class);
|
||||
assertThat(((TestBean) status.getValue()).getName()).as("Correct value").isEqualTo("name0");
|
||||
assertThat(status.isError()).as("Correct isError").isTrue();
|
||||
assertThat(status.getErrorCodes()).as("Correct errorCodes").hasSize(2);
|
||||
@@ -508,8 +506,7 @@ class BindTagTests extends AbstractTagTests {
|
||||
BindStatus status = (BindStatus) pc.getAttribute(BindTag.STATUS_VARIABLE_NAME, PageContext.REQUEST_SCOPE);
|
||||
assertThat(status).as("Has status variable").isNotNull();
|
||||
assertThat(status.getExpression()).as("Correct expression").isEqualTo("map[key1]");
|
||||
boolean condition = status.getValue() instanceof TestBean;
|
||||
assertThat(condition).as("Value is TestBean").isTrue();
|
||||
assertThat(status.getValue()).as("Value is TestBean").isInstanceOf(TestBean.class);
|
||||
assertThat(((TestBean) status.getValue()).getName()).as("Correct value").isEqualTo("name4");
|
||||
assertThat(status.isError()).as("Correct isError").isTrue();
|
||||
assertThat(status.getErrorCodes()).as("Correct errorCodes").hasSize(2);
|
||||
@@ -544,8 +541,7 @@ class BindTagTests extends AbstractTagTests {
|
||||
assertThat(status).as("Has status variable").isNotNull();
|
||||
assertThat(status.getExpression()).as("Correct expression").isEqualTo("array[0]");
|
||||
// because of the custom editor getValue() should return a String
|
||||
boolean condition = status.getValue() instanceof String;
|
||||
assertThat(condition).as("Value is TestBean").isTrue();
|
||||
assertThat(status.getValue()).as("Value is TestBean").isInstanceOf(String.class);
|
||||
assertThat(status.getValue()).as("Correct value").isEqualTo("something");
|
||||
}
|
||||
|
||||
@@ -563,8 +559,7 @@ class BindTagTests extends AbstractTagTests {
|
||||
tag.doStartTag();
|
||||
BindStatus status = (BindStatus) pc.getAttribute(BindTag.STATUS_VARIABLE_NAME, PageContext.REQUEST_SCOPE);
|
||||
assertThat(status.getExpression()).isEqualTo("doctor");
|
||||
boolean condition = status.getValue() instanceof NestedTestBean;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(status.getValue()).isInstanceOf(NestedTestBean.class);
|
||||
assertThat(status.getDisplayValue()).contains("juergen&eva");
|
||||
}
|
||||
|
||||
@@ -579,8 +574,7 @@ class BindTagTests extends AbstractTagTests {
|
||||
tag.doStartTag();
|
||||
BindStatus status = (BindStatus) pc.getAttribute(BindTag.STATUS_VARIABLE_NAME, PageContext.REQUEST_SCOPE);
|
||||
assertThat(status.getExpression()).isEqualTo("someSet");
|
||||
boolean condition = status.getValue() instanceof Set;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(status.getValue()).isInstanceOf(Set.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+12
-24
@@ -48,20 +48,16 @@ class HtmlEscapeTagTests extends AbstractTagTests {
|
||||
testTag.setPageContext(pc);
|
||||
testTag.doStartTag();
|
||||
|
||||
boolean condition7 = !tag.getRequestContext().isDefaultHtmlEscape();
|
||||
assertThat(condition7).as("Correct default").isTrue();
|
||||
boolean condition6 = !testTag.isHtmlEscape();
|
||||
assertThat(condition6).as("Correctly applied").isTrue();
|
||||
assertThat(tag.getRequestContext().isDefaultHtmlEscape()).as("Correct default").isFalse();
|
||||
assertThat(testTag.isHtmlEscape()).as("Correctly applied").isFalse();
|
||||
tag.setDefaultHtmlEscape(true);
|
||||
assertThat(tag.doStartTag()).as("Correct doStartTag return value").isEqualTo(Tag.EVAL_BODY_INCLUDE);
|
||||
assertThat(tag.getRequestContext().isDefaultHtmlEscape()).as("Correctly enabled").isTrue();
|
||||
assertThat(testTag.isHtmlEscape()).as("Correctly applied").isTrue();
|
||||
tag.setDefaultHtmlEscape(false);
|
||||
assertThat(tag.doStartTag()).as("Correct doStartTag return value").isEqualTo(Tag.EVAL_BODY_INCLUDE);
|
||||
boolean condition5 = !tag.getRequestContext().isDefaultHtmlEscape();
|
||||
assertThat(condition5).as("Correctly disabled").isTrue();
|
||||
boolean condition4 = !testTag.isHtmlEscape();
|
||||
assertThat(condition4).as("Correctly applied").isTrue();
|
||||
assertThat(tag.getRequestContext().isDefaultHtmlEscape()).as("Correctly disabled").isFalse();
|
||||
assertThat(testTag.isHtmlEscape()).as("Correctly applied").isFalse();
|
||||
|
||||
tag.setDefaultHtmlEscape(true);
|
||||
assertThat(tag.doStartTag()).as("Correct doStartTag return value").isEqualTo(Tag.EVAL_BODY_INCLUDE);
|
||||
@@ -70,19 +66,15 @@ class HtmlEscapeTagTests extends AbstractTagTests {
|
||||
assertThat(testTag.isHtmlEscape()).as("Correctly applied").isTrue();
|
||||
testTag.setHtmlEscape(false);
|
||||
assertThat(tag.getRequestContext().isDefaultHtmlEscape()).as("Correctly enabled").isTrue();
|
||||
boolean condition3 = !testTag.isHtmlEscape();
|
||||
assertThat(condition3).as("Correctly applied").isTrue();
|
||||
assertThat(testTag.isHtmlEscape()).as("Correctly applied").isFalse();
|
||||
tag.setDefaultHtmlEscape(false);
|
||||
assertThat(tag.doStartTag()).as("Correct doStartTag return value").isEqualTo(Tag.EVAL_BODY_INCLUDE);
|
||||
testTag.setHtmlEscape(true);
|
||||
boolean condition2 = !tag.getRequestContext().isDefaultHtmlEscape();
|
||||
assertThat(condition2).as("Correctly disabled").isTrue();
|
||||
assertThat(tag.getRequestContext().isDefaultHtmlEscape()).as("Correctly disabled").isFalse();
|
||||
assertThat(testTag.isHtmlEscape()).as("Correctly applied").isTrue();
|
||||
testTag.setHtmlEscape(false);
|
||||
boolean condition1 = !tag.getRequestContext().isDefaultHtmlEscape();
|
||||
assertThat(condition1).as("Correctly disabled").isTrue();
|
||||
boolean condition = !testTag.isHtmlEscape();
|
||||
assertThat(condition).as("Correctly applied").isTrue();
|
||||
assertThat(tag.getRequestContext().isDefaultHtmlEscape()).as("Correctly disabled").isFalse();
|
||||
assertThat(testTag.isHtmlEscape()).as("Correctly applied").isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -95,15 +87,13 @@ class HtmlEscapeTagTests extends AbstractTagTests {
|
||||
tag.setPageContext(pc);
|
||||
tag.doStartTag();
|
||||
|
||||
boolean condition1 = !tag.getRequestContext().isDefaultHtmlEscape();
|
||||
assertThat(condition1).as("Correct default").isTrue();
|
||||
assertThat(tag.getRequestContext().isDefaultHtmlEscape()).as("Correct default").isFalse();
|
||||
tag.setDefaultHtmlEscape(true);
|
||||
assertThat(tag.doStartTag()).as("Correct doStartTag return value").isEqualTo(Tag.EVAL_BODY_INCLUDE);
|
||||
assertThat(tag.getRequestContext().isDefaultHtmlEscape()).as("Correctly enabled").isTrue();
|
||||
tag.setDefaultHtmlEscape(false);
|
||||
assertThat(tag.doStartTag()).as("Correct doStartTag return value").isEqualTo(Tag.EVAL_BODY_INCLUDE);
|
||||
boolean condition = !tag.getRequestContext().isDefaultHtmlEscape();
|
||||
assertThat(condition).as("Correctly disabled").isTrue();
|
||||
assertThat(tag.getRequestContext().isDefaultHtmlEscape()).as("Correctly disabled").isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -115,15 +105,13 @@ class HtmlEscapeTagTests extends AbstractTagTests {
|
||||
tag.doStartTag();
|
||||
|
||||
sc.addInitParameter(WebUtils.HTML_ESCAPE_CONTEXT_PARAM, "false");
|
||||
boolean condition1 = !tag.getRequestContext().isDefaultHtmlEscape();
|
||||
assertThat(condition1).as("Correct default").isTrue();
|
||||
assertThat(tag.getRequestContext().isDefaultHtmlEscape()).as("Correct default").isFalse();
|
||||
tag.setDefaultHtmlEscape(true);
|
||||
assertThat(tag.doStartTag()).as("Correct doStartTag return value").isEqualTo(Tag.EVAL_BODY_INCLUDE);
|
||||
assertThat(tag.getRequestContext().isDefaultHtmlEscape()).as("Correctly enabled").isTrue();
|
||||
tag.setDefaultHtmlEscape(false);
|
||||
assertThat(tag.doStartTag()).as("Correct doStartTag return value").isEqualTo(Tag.EVAL_BODY_INCLUDE);
|
||||
boolean condition = !tag.getRequestContext().isDefaultHtmlEscape();
|
||||
assertThat(condition).as("Correctly disabled").isTrue();
|
||||
assertThat(tag.getRequestContext().isDefaultHtmlEscape()).as("Correctly disabled").isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+1
-1
@@ -237,7 +237,7 @@ class MessageTagTests extends AbstractTagTests {
|
||||
tag.setText("testtext");
|
||||
assertThat(tag.doStartTag()).as("Correct doStartTag return value").isEqualTo(Tag.EVAL_BODY_INCLUDE);
|
||||
assertThat(tag.doEndTag()).as("Correct doEndTag return value").isEqualTo(Tag.EVAL_PAGE);
|
||||
assertThat((message.toString())).as("Correct message").isEqualTo("test message");
|
||||
assertThat(message.toString()).as("Correct message").isEqualTo("test message");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+2
-4
@@ -345,8 +345,7 @@ class ErrorsTagTests extends AbstractFormTagTests {
|
||||
int result = this.tag.doStartTag();
|
||||
assertThat(result).isEqualTo(BodyTag.EVAL_BODY_BUFFERED);
|
||||
assertThat(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE)).isNotNull();
|
||||
boolean condition = getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE) instanceof List;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE)).isInstanceOf(List.class);
|
||||
String bodyContent = "Foo";
|
||||
this.tag.setBodyContent(new MockBodyContent(bodyContent, getWriter()));
|
||||
this.tag.doEndTag();
|
||||
@@ -366,8 +365,7 @@ class ErrorsTagTests extends AbstractFormTagTests {
|
||||
int result = this.tag.doStartTag();
|
||||
assertThat(result).isEqualTo(BodyTag.EVAL_BODY_BUFFERED);
|
||||
assertThat(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE)).isNotNull();
|
||||
boolean condition = getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE) instanceof List;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(getPageContext().getAttribute(ErrorsTag.MESSAGES_ATTRIBUTE)).isInstanceOf(List.class);
|
||||
String bodyContent = "Foo";
|
||||
this.tag.setBodyContent(new MockBodyContent(bodyContent, getWriter()));
|
||||
this.tag.doEndTag();
|
||||
|
||||
+1
-1
@@ -1125,7 +1125,7 @@ class SelectTagTests extends AbstractFormTagTests {
|
||||
Element e = (Element) rootElement.selectSingleNode("option[@value = 'UK']");
|
||||
Attribute selectedAttr = e.attribute("selected");
|
||||
if (selected) {
|
||||
assertThat(selectedAttr != null && "selected".equals(selectedAttr.getValue())).isTrue();
|
||||
assertThat(selectedAttr.getValue()).isEqualTo("selected");
|
||||
}
|
||||
else {
|
||||
assertThat(selectedAttr).isNull();
|
||||
|
||||
@@ -217,8 +217,8 @@ class BaseViewTests {
|
||||
AbstractView v = new ConcreteView();
|
||||
v.setAttributesCSV("foo=[bar],king=[kong]");
|
||||
assertThat(v.getStaticAttributes()).hasSize(2);
|
||||
assertThat(v.getStaticAttributes().get("foo").equals("bar")).isTrue();
|
||||
assertThat(v.getStaticAttributes().get("king").equals("kong")).isTrue();
|
||||
assertThat(v.getStaticAttributes().get("foo")).isEqualTo("bar");
|
||||
assertThat(v.getStaticAttributes().get("king")).isEqualTo("kong");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+1
-1
@@ -364,7 +364,7 @@ class RedirectViewTests {
|
||||
*/
|
||||
@Override
|
||||
protected Map<String, Object> queryProperties(Map<String, Object> model) {
|
||||
assertThat(this.expectedModel.equals(model)).as("Map and model must be equal.").isTrue();
|
||||
assertThat(this.expectedModel).as("Map and model must be equal.").isEqualTo(model);
|
||||
this.queryPropertiesCalled = true;
|
||||
return super.queryProperties(model);
|
||||
}
|
||||
|
||||
+5
-6
@@ -182,9 +182,8 @@ class ViewResolverTests {
|
||||
TestBean tb = new TestBean();
|
||||
model.put("tb", tb);
|
||||
view.render(model, this.request, this.response);
|
||||
assertThat(tb.equals(this.request.getAttribute("tb"))).as("Correct tb attribute").isTrue();
|
||||
boolean condition = this.request.getAttribute("rc") instanceof RequestContext;
|
||||
assertThat(condition).as("Correct rc attribute").isTrue();
|
||||
assertThat(tb).as("Correct tb attribute").isEqualTo(this.request.getAttribute("tb"));
|
||||
assertThat(this.request.getAttribute("rc")).as("Correct rc attribute").isInstanceOf(RequestContext.class);
|
||||
|
||||
view = vr.resolveViewName("redirect:myUrl", Locale.getDefault());
|
||||
assertThat(view.getClass()).as("Correct view class").isEqualTo(RedirectView.class);
|
||||
@@ -252,7 +251,7 @@ class ViewResolverTests {
|
||||
model.put("tb", tb);
|
||||
view.render(model, this.request, this.response);
|
||||
|
||||
assertThat(tb.equals(this.request.getAttribute("tb"))).as("Correct tb attribute").isTrue();
|
||||
assertThat(tb).as("Correct tb attribute").isEqualTo(this.request.getAttribute("tb"));
|
||||
assertThat(this.request.getAttribute("rc")).as("Correct rc attribute").isNull();
|
||||
assertThat(this.request.getAttribute("key1")).isEqualTo("value1");
|
||||
assertThat(this.request.getAttribute("key2")).isEqualTo(2);
|
||||
@@ -355,7 +354,7 @@ class ViewResolverTests {
|
||||
model.put("tb", tb);
|
||||
view.render(model, this.request, this.response);
|
||||
|
||||
assertThat(tb.equals(this.request.getAttribute("tb"))).as("Correct tb attribute").isTrue();
|
||||
assertThat(tb).as("Correct tb attribute").isEqualTo(this.request.getAttribute("tb"));
|
||||
assertThat(this.request.getAttribute("rc")).as("Correct rc attribute").isNull();
|
||||
|
||||
assertThat(Config.get(this.request, Config.FMT_LOCALE)).isEqualTo(locale);
|
||||
@@ -389,7 +388,7 @@ class ViewResolverTests {
|
||||
model.put("tb", tb);
|
||||
view.render(model, this.request, this.response);
|
||||
|
||||
assertThat(tb.equals(this.request.getAttribute("tb"))).as("Correct tb attribute").isTrue();
|
||||
assertThat(tb).as("Correct tb attribute").isEqualTo(this.request.getAttribute("tb"));
|
||||
assertThat(this.request.getAttribute("rc")).as("Correct rc attribute").isNull();
|
||||
|
||||
assertThat(Config.get(this.request, Config.FMT_LOCALE)).isEqualTo(locale);
|
||||
|
||||
Reference in New Issue
Block a user