Replace assertThat(x.isEmpty()).isTrue() with assertThat(x).isEmpty()
Search for : assertThat\((.+).isEmpty\(\)\).isTrue\(\) Replace with : assertThat($1).isEmpty() Search for : assertThat\((.+).isEmpty\(\)\).isFalse\(\) Replace with : assertThat($1).isNotEmpty() Closes gh-31758
This commit is contained in:
committed by
Brian Clozel
parent
7b16ef90f1
commit
afcd03bddc
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -103,7 +103,7 @@ public class FlashMapTests {
|
||||
flashMap.addTargetRequestParam(" ", "abc");
|
||||
flashMap.addTargetRequestParam(null, "abc");
|
||||
|
||||
assertThat(flashMap.getTargetRequestParams().isEmpty()).isTrue();
|
||||
assertThat(flashMap.getTargetRequestParams()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -115,7 +115,7 @@ public class FlashMapTests {
|
||||
FlashMap flashMap = new FlashMap();
|
||||
flashMap.addTargetRequestParams(params);
|
||||
|
||||
assertThat(flashMap.getTargetRequestParams().isEmpty()).isTrue();
|
||||
assertThat(flashMap.getTargetRequestParams()).isEmpty();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 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,7 +43,7 @@ public class CorsRegistryTests {
|
||||
|
||||
@Test
|
||||
public void noMapping() {
|
||||
assertThat(this.registry.getCorsConfigurations().isEmpty()).isTrue();
|
||||
assertThat(this.registry.getCorsConfigurations()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -52,14 +52,14 @@ public class ParameterizableViewControllerTests {
|
||||
this.controller.setViewName(viewName);
|
||||
ModelAndView mav = this.controller.handleRequest(this.request, new MockHttpServletResponse());
|
||||
assertThat(mav.getViewName()).isEqualTo(viewName);
|
||||
assertThat(mav.getModel().isEmpty()).isTrue();
|
||||
assertThat(mav.getModel()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handleRequestWithoutViewName() throws Exception {
|
||||
ModelAndView mav = this.controller.handleRequest(this.request, new MockHttpServletResponse());
|
||||
assertThat(mav.getViewName()).isNull();
|
||||
assertThat(mav.getModel().isEmpty()).isTrue();
|
||||
assertThat(mav.getModel()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -54,7 +54,7 @@ class UrlFilenameViewControllerTests {
|
||||
MockHttpServletRequest request = requestFactory.apply("/index");
|
||||
ModelAndView mv = controller.handleRequest(request, new MockHttpServletResponse());
|
||||
assertThat(mv.getViewName()).isEqualTo("index");
|
||||
assertThat(mv.getModel().isEmpty()).isTrue();
|
||||
assertThat(mv.getModel()).isEmpty();
|
||||
}
|
||||
|
||||
@PathPatternsParameterizedTest
|
||||
@@ -63,7 +63,7 @@ class UrlFilenameViewControllerTests {
|
||||
MockHttpServletRequest request = requestFactory.apply("/index.html");
|
||||
ModelAndView mv = controller.handleRequest(request, new MockHttpServletResponse());
|
||||
assertThat(mv.getViewName()).isEqualTo("index");
|
||||
assertThat(mv.getModel().isEmpty()).isTrue();
|
||||
assertThat(mv.getModel()).isEmpty();
|
||||
}
|
||||
|
||||
@PathPatternsParameterizedTest
|
||||
@@ -72,7 +72,7 @@ class UrlFilenameViewControllerTests {
|
||||
MockHttpServletRequest request = requestFactory.apply("/index;a=A;b=B");
|
||||
ModelAndView mv = controller.handleRequest(request, new MockHttpServletResponse());
|
||||
assertThat(mv.getViewName()).isEqualTo("index");
|
||||
assertThat(mv.getModel().isEmpty()).isTrue();
|
||||
assertThat(mv.getModel()).isEmpty();
|
||||
}
|
||||
|
||||
@PathPatternsParameterizedTest
|
||||
@@ -83,7 +83,7 @@ class UrlFilenameViewControllerTests {
|
||||
MockHttpServletRequest request = requestFactory.apply("/index.html");
|
||||
ModelAndView mv = controller.handleRequest(request, new MockHttpServletResponse());
|
||||
assertThat(mv.getViewName()).isEqualTo("mypre_index_mysuf");
|
||||
assertThat(mv.getModel().isEmpty()).isTrue();
|
||||
assertThat(mv.getModel()).isEmpty();
|
||||
}
|
||||
|
||||
@PathPatternsParameterizedTest
|
||||
@@ -93,7 +93,7 @@ class UrlFilenameViewControllerTests {
|
||||
MockHttpServletRequest request = requestFactory.apply("/index.html");
|
||||
ModelAndView mv = controller.handleRequest(request, new MockHttpServletResponse());
|
||||
assertThat(mv.getViewName()).isEqualTo("mypre_index");
|
||||
assertThat(mv.getModel().isEmpty()).isTrue();
|
||||
assertThat(mv.getModel()).isEmpty();
|
||||
}
|
||||
|
||||
@PathPatternsParameterizedTest
|
||||
@@ -103,7 +103,7 @@ class UrlFilenameViewControllerTests {
|
||||
MockHttpServletRequest request = requestFactory.apply("/index.html");
|
||||
ModelAndView mv = controller.handleRequest(request, new MockHttpServletResponse());
|
||||
assertThat(mv.getViewName()).isEqualTo("index_mysuf");
|
||||
assertThat(mv.getModel().isEmpty()).isTrue();
|
||||
assertThat(mv.getModel()).isEmpty();
|
||||
}
|
||||
|
||||
@PathPatternsParameterizedTest
|
||||
@@ -112,7 +112,7 @@ class UrlFilenameViewControllerTests {
|
||||
MockHttpServletRequest request = requestFactory.apply("/docs/cvs/commit.html");
|
||||
ModelAndView mv = controller.handleRequest(request, new MockHttpServletResponse());
|
||||
assertThat(mv.getViewName()).isEqualTo("docs/cvs/commit");
|
||||
assertThat(mv.getModel().isEmpty()).isTrue();
|
||||
assertThat(mv.getModel()).isEmpty();
|
||||
}
|
||||
|
||||
@PathPatternsParameterizedTest
|
||||
@@ -122,7 +122,7 @@ class UrlFilenameViewControllerTests {
|
||||
exposePathInMapping(request, "/docs/**");
|
||||
ModelAndView mv = controller.handleRequest(request, new MockHttpServletResponse());
|
||||
assertThat(mv.getViewName()).isEqualTo("cvs/commit");
|
||||
assertThat(mv.getModel().isEmpty()).isTrue();
|
||||
assertThat(mv.getModel()).isEmpty();
|
||||
}
|
||||
|
||||
@PathPatternsParameterizedTest
|
||||
@@ -132,7 +132,7 @@ class UrlFilenameViewControllerTests {
|
||||
exposePathInMapping(request, "/docs/cvs/commit.html");
|
||||
ModelAndView mv = controller.handleRequest(request, new MockHttpServletResponse());
|
||||
assertThat(mv.getViewName()).isEqualTo("docs/cvs/commit");
|
||||
assertThat(mv.getModel().isEmpty()).isTrue();
|
||||
assertThat(mv.getModel()).isEmpty();
|
||||
}
|
||||
|
||||
@PathPatternsParameterizedTest
|
||||
@@ -143,7 +143,7 @@ class UrlFilenameViewControllerTests {
|
||||
ServletRequestPathUtils.parseAndCache(request);
|
||||
ModelAndView mv = controller.handleRequest(request, new MockHttpServletResponse());
|
||||
assertThat(mv.getViewName()).isEqualTo("docs/cvs/commit");
|
||||
assertThat(mv.getModel().isEmpty()).isTrue();
|
||||
assertThat(mv.getModel()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -180,7 +180,7 @@ class UrlFilenameViewControllerTests {
|
||||
MockHttpServletRequest request = requestFactory.apply("/products/view.html");
|
||||
ModelAndView mv = controller.handleRequest(request, new MockHttpServletResponse());
|
||||
assertThat(mv.getViewName()).isEqualTo("products/view");
|
||||
assertThat(mv.getModel().isEmpty()).isTrue();
|
||||
assertThat(mv.getModel()).isEmpty();
|
||||
}
|
||||
|
||||
@PathPatternsParameterizedTest
|
||||
|
||||
@@ -140,7 +140,7 @@ public class ModelAndViewMethodReturnValueHandlerTests {
|
||||
|
||||
ModelMap model = mavContainer.getModel();
|
||||
assertThat(mavContainer.getView()).isNull();
|
||||
assertThat(mavContainer.getModel().isEmpty()).isTrue();
|
||||
assertThat(mavContainer.getModel()).isEmpty();
|
||||
assertThat(model).as("RedirectAttributes should not be used if controller doesn't redirect").isNotSameAs(redirectAttributes);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -89,7 +89,7 @@ public class ModelAndViewResolverMethodReturnValueHandlerTests {
|
||||
|
||||
assertThat(mavContainer.getView()).isNull();
|
||||
assertThat(mavContainer.getViewName()).isNull();
|
||||
assertThat(mavContainer.getModel().isEmpty()).isTrue();
|
||||
assertThat(mavContainer.getModel()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1671,7 +1671,7 @@ class ServletAnnotationControllerHandlerMethodTests extends AbstractServletHandl
|
||||
|
||||
assertThat(response.getStatus()).isEqualTo(200);
|
||||
assertThat(response.getForwardedUrl()).isEqualTo("messages/new");
|
||||
assertThat(RequestContextUtils.getOutputFlashMap(request).isEmpty()).isTrue();
|
||||
assertThat((Map<?, ?>) RequestContextUtils.getOutputFlashMap(request)).isEmpty();
|
||||
|
||||
// POST -> success
|
||||
request = new MockHttpServletRequest("POST", "/messages");
|
||||
@@ -1693,7 +1693,7 @@ class ServletAnnotationControllerHandlerMethodTests extends AbstractServletHandl
|
||||
|
||||
assertThat(response.getStatus()).isEqualTo(200);
|
||||
assertThat(response.getContentAsString()).isEqualTo("Got: yay!");
|
||||
assertThat(RequestContextUtils.getOutputFlashMap(request).isEmpty()).isTrue();
|
||||
assertThat((Map<?, ?>) RequestContextUtils.getOutputFlashMap(request)).isEmpty();
|
||||
}
|
||||
|
||||
@PathPatternsParameterizedTest // SPR-15176
|
||||
@@ -1719,7 +1719,7 @@ class ServletAnnotationControllerHandlerMethodTests extends AbstractServletHandl
|
||||
|
||||
assertThat(response.getStatus()).isEqualTo(200);
|
||||
assertThat(response.getContentAsString()).isEqualTo("Got: yay!");
|
||||
assertThat(RequestContextUtils.getOutputFlashMap(request).isEmpty()).isTrue();
|
||||
assertThat((Map<?, ?>) RequestContextUtils.getOutputFlashMap(request)).isEmpty();
|
||||
}
|
||||
|
||||
@PathPatternsParameterizedTest
|
||||
|
||||
Reference in New Issue
Block a user