Browse Source

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
pull/31769/head
Yanming Zhou 2 years ago committed by Brian Clozel
parent
commit
afcd03bddc
  1. 2
      spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests.java
  2. 12
      spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java
  3. 4
      spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPathFactoryBeanTests.java
  4. 5
      spring-context/src/test/java/org/springframework/beans/factory/xml/QualifierAnnotationTests.java
  5. 4
      spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java
  6. 6
      spring-context/src/test/java/org/springframework/context/annotation/LazyAutowiredAnnotationBeanPostProcessorTests.java
  7. 2
      spring-context/src/test/java/org/springframework/context/annotation/configuration/AutowiredConfigurationTests.java
  8. 2
      spring-context/src/test/java/org/springframework/context/event/AnnotationDrivenEventListenerTests.java
  9. 6
      spring-context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java
  10. 2
      spring-context/src/test/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessorTests.java
  11. 2
      spring-context/src/test/java/org/springframework/validation/DataBinderTests.java
  12. 8
      spring-core-test/src/test/java/org/springframework/core/test/tools/ClassFilesTests.java
  13. 8
      spring-core-test/src/test/java/org/springframework/core/test/tools/ResourceFilesTests.java
  14. 8
      spring-core-test/src/test/java/org/springframework/core/test/tools/SourceFilesTests.java
  15. 6
      spring-core/src/test/java/org/springframework/core/annotation/AnnotatedElementUtilsTests.java
  16. 2
      spring-core/src/test/java/org/springframework/core/convert/support/CollectionToCollectionConverterTests.java
  17. 4
      spring-core/src/test/java/org/springframework/util/AntPathMatcherTests.java
  18. 2
      spring-core/src/test/java/org/springframework/util/CollectionUtilsTests.java
  19. 12
      spring-core/src/test/java/org/springframework/util/ConcurrentReferenceHashMapTests.java
  20. 2
      spring-core/src/test/java/org/springframework/util/UnmodifiableMultiValueMapTests.java
  21. 2
      spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java
  22. 2
      spring-jdbc/src/test/java/org/springframework/jdbc/datasource/DataSourceJtaTransactionTests.java
  23. 2
      spring-jms/src/test/java/org/springframework/jms/connection/JmsTransactionManagerTests.java
  24. 2
      spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTests.java
  25. 2
      spring-messaging/src/test/java/org/springframework/messaging/handler/annotation/support/PayloadMethodArgumentResolverTests.java
  26. 2
      spring-orm/src/test/java/org/springframework/orm/jpa/ContainerManagedEntityManagerIntegrationTests.java
  27. 4
      spring-orm/src/test/java/org/springframework/orm/jpa/EntityManagerFactoryUtilsTests.java
  28. 2
      spring-orm/src/test/java/org/springframework/orm/jpa/support/OpenEntityManagerInViewTests.java
  29. 4
      spring-orm/src/test/java/org/springframework/orm/jpa/support/PersistenceContextTransactionTests.java
  30. 2
      spring-orm/src/test/java/org/springframework/orm/jpa/support/SharedEntityManagerFactoryTests.java
  31. 2
      spring-test/src/test/java/org/springframework/mock/web/MockMultipartHttpServletRequestTests.java
  32. 2
      spring-tx/src/test/java/org/springframework/transaction/JndiJtaTransactionManagerTests.java
  33. 2
      spring-tx/src/test/java/org/springframework/transaction/JtaTransactionManagerTests.java
  34. 4
      spring-tx/src/test/java/org/springframework/transaction/support/SimpleTransactionScopeTests.java
  35. 4
      spring-web/src/test/java/org/springframework/http/HttpEntityTests.java
  36. 14
      spring-web/src/test/java/org/springframework/http/HttpHeadersTests.java
  37. 2
      spring-web/src/test/java/org/springframework/http/MediaTypeFactoryTests.java
  38. 2
      spring-web/src/test/java/org/springframework/http/ResponseEntityTests.java
  39. 6
      spring-web/src/test/java/org/springframework/http/server/reactive/ServerHttpResponseTests.java
  40. 4
      spring-web/src/test/java/org/springframework/web/method/support/ModelAndViewContainerTests.java
  41. 2
      spring-web/src/test/java/org/springframework/web/util/ContentCachingRequestWrapperTests.java
  42. 4
      spring-web/src/test/java/org/springframework/web/util/UriComponentsBuilderTests.java
  43. 4
      spring-webflux/src/test/java/org/springframework/web/reactive/config/CorsRegistryTests.java
  44. 18
      spring-webflux/src/test/java/org/springframework/web/reactive/function/client/ExchangeStrategiesTests.java
  45. 6
      spring-webflux/src/test/java/org/springframework/web/reactive/function/server/DefaultServerResponseBuilderTests.java
  46. 14
      spring-webflux/src/test/java/org/springframework/web/reactive/function/server/HandlerStrategiesTests.java
  47. 6
      spring-webmvc/src/test/java/org/springframework/web/servlet/FlashMapTests.java
  48. 4
      spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/CorsRegistryTests.java
  49. 6
      spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/ParameterizableViewControllerTests.java
  50. 22
      spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/UrlFilenameViewControllerTests.java
  51. 2
      spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ModelAndViewMethodReturnValueHandlerTests.java
  52. 4
      spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ModelAndViewResolverMethodReturnValueHandlerTests.java
  53. 6
      spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletAnnotationControllerHandlerMethodTests.java
  54. 4
      spring-websocket/src/test/java/org/springframework/web/socket/config/HandlersBeanDefinitionParserTests.java
  55. 2
      spring-websocket/src/test/java/org/springframework/web/socket/sockjs/support/SockJsServiceTests.java

2
spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests.java

@ -134,7 +134,7 @@ public class BeanFactoryUtilsTests { @@ -134,7 +134,7 @@ public class BeanFactoryUtilsTests {
StaticListableBeanFactory lbf = new StaticListableBeanFactory();
lbf.addBean("foo", new Object());
Map<String, ?> beans = BeanFactoryUtils.beansOfTypeIncludingAncestors(lbf, ITestBean.class, true, false);
assertThat(beans.isEmpty()).isTrue();
assertThat(beans).isEmpty();
}
@Test

12
spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java

@ -1143,7 +1143,7 @@ public class AutowiredAnnotationBeanPostProcessorTests { @@ -1143,7 +1143,7 @@ public class AutowiredAnnotationBeanPostProcessorTests {
SingleConstructorVarargBean bean = bf.getBean("annotatedBean", SingleConstructorVarargBean.class);
assertThat(bean.getTestBean()).isSameAs(tb);
assertThat(bean.getNestedTestBeans()).isNotNull();
assertThat(bean.getNestedTestBeans().isEmpty()).isTrue();
assertThat(bean.getNestedTestBeans()).isEmpty();
}
@Test
@ -1172,7 +1172,7 @@ public class AutowiredAnnotationBeanPostProcessorTests { @@ -1172,7 +1172,7 @@ public class AutowiredAnnotationBeanPostProcessorTests {
SingleConstructorRequiredCollectionBean bean = bf.getBean("annotatedBean", SingleConstructorRequiredCollectionBean.class);
assertThat(bean.getTestBean()).isSameAs(tb);
assertThat(bean.getNestedTestBeans()).isNotNull();
assertThat(bean.getNestedTestBeans().isEmpty()).isTrue();
assertThat(bean.getNestedTestBeans()).isEmpty();
}
@Test
@ -1666,13 +1666,13 @@ public class AutowiredAnnotationBeanPostProcessorTests { @@ -1666,13 +1666,13 @@ public class AutowiredAnnotationBeanPostProcessorTests {
assertThat(bean.consumeUniqueTestBean()).isNull();
List<?> testBeans = bean.iterateTestBeans();
assertThat(testBeans.isEmpty()).isTrue();
assertThat(testBeans).isEmpty();
testBeans = bean.forEachTestBeans();
assertThat(testBeans.isEmpty()).isTrue();
assertThat(testBeans).isEmpty();
testBeans = bean.streamTestBeans();
assertThat(testBeans.isEmpty()).isTrue();
assertThat(testBeans).isEmpty();
testBeans = bean.sortedTestBeans();
assertThat(testBeans.isEmpty()).isTrue();
assertThat(testBeans).isEmpty();
}
@Test

4
spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyPathFactoryBeanTests.java

@ -89,8 +89,8 @@ public class PropertyPathFactoryBeanTests { @@ -89,8 +89,8 @@ public class PropertyPathFactoryBeanTests {
TestBean spouse = (TestBean) xbf.getBean("otb.spouse");
TestBean tbWithInner = (TestBean) xbf.getBean("tbWithInner");
assertThat(tbWithInner.getSpouse()).isSameAs(spouse);
assertThat(tbWithInner.getFriends().isEmpty()).isFalse();
assertThat(tbWithInner.getFriends()).element(0).isSameAs(spouse);
assertThat(tbWithInner.getFriends()).isNotEmpty();
assertThat(tbWithInner.getFriends().iterator().next()).isSameAs(spouse);
}
@Test

5
spring-context/src/test/java/org/springframework/beans/factory/xml/QualifierAnnotationTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.
@ -110,7 +110,8 @@ public class QualifierAnnotationTests { @@ -110,7 +110,8 @@ public class QualifierAnnotationTests {
QualifiedByBeanNameTestBean testBean = (QualifiedByBeanNameTestBean) context.getBean("testBean");
Person person = testBean.getLarry();
assertThat(person.getName()).isEqualTo("LarryBean");
assertThat(testBean.myProps != null && testBean.myProps.isEmpty()).isTrue();
assertThat(testBean.myProps).isNotNull();
assertThat(testBean.myProps).isEmpty();
}
@Test

4
spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java

@ -1059,7 +1059,7 @@ class ConfigurationClassPostProcessorTests { @@ -1059,7 +1059,7 @@ class ConfigurationClassPostProcessorTests {
ConfigurableApplicationContext ctx = new AnnotationConfigApplicationContext(CollectionArgumentConfiguration.class);
CollectionArgumentConfiguration bean = ctx.getBean(CollectionArgumentConfiguration.class);
assertThat(bean.testBeans).isNotNull();
assertThat(bean.testBeans.isEmpty()).isTrue();
assertThat(bean.testBeans).isEmpty();
ctx.close();
}
@ -1078,7 +1078,7 @@ class ConfigurationClassPostProcessorTests { @@ -1078,7 +1078,7 @@ class ConfigurationClassPostProcessorTests {
ConfigurableApplicationContext ctx = new AnnotationConfigApplicationContext(MapArgumentConfiguration.class);
MapArgumentConfiguration bean = ctx.getBean(MapArgumentConfiguration.class);
assertThat(bean.testBeans).isNotNull();
assertThat(bean.testBeans.isEmpty()).isTrue();
assertThat(bean.testBeans).isEmpty();
ctx.close();
}

6
spring-context/src/test/java/org/springframework/context/annotation/LazyAutowiredAnnotationBeanPostProcessorTests.java

@ -1,5 +1,5 @@ @@ -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.
@ -81,7 +81,7 @@ class LazyAutowiredAnnotationBeanPostProcessorTests { @@ -81,7 +81,7 @@ class LazyAutowiredAnnotationBeanPostProcessorTests {
FieldResourceInjectionBean bean = ac.getBean("annotatedBean", FieldResourceInjectionBean.class);
assertThat(ac.getBeanFactory().containsSingleton("testBean")).isFalse();
assertThat(bean.getTestBeans().isEmpty()).isFalse();
assertThat(bean.getTestBeans()).isNotEmpty();
assertThat(bean.getTestBeans().get(0).getName()).isNull();
assertThat(ac.getBeanFactory().containsSingleton("testBean")).isTrue();
TestBean tb = (TestBean) ac.getBean("testBean");
@ -156,7 +156,7 @@ class LazyAutowiredAnnotationBeanPostProcessorTests { @@ -156,7 +156,7 @@ class LazyAutowiredAnnotationBeanPostProcessorTests {
OptionalFieldResourceInjectionBean bean = (OptionalFieldResourceInjectionBean) bf.getBean("annotatedBean");
assertThat(bean.getTestBean()).isNotNull();
assertThat(bean.getTestBeans()).isNotNull();
assertThat(bean.getTestBeans().isEmpty()).isTrue();
assertThat(bean.getTestBeans()).isEmpty();
assertThatExceptionOfType(NoSuchBeanDefinitionException.class).isThrownBy(() ->
bean.getTestBean().getName());
}

2
spring-context/src/test/java/org/springframework/context/annotation/configuration/AutowiredConfigurationTests.java

@ -91,7 +91,7 @@ class AutowiredConfigurationTests { @@ -91,7 +91,7 @@ class AutowiredConfigurationTests {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
OptionalAutowiredMethodConfig.class);
assertThat(context.getBeansOfType(Colour.class).isEmpty()).isTrue();
assertThat(context.getBeansOfType(Colour.class)).isEmpty();
assertThat(context.getBean(TestBean.class).getName()).isEmpty();
context.close();
}

2
spring-context/src/test/java/org/springframework/context/event/AnnotationDrivenEventListenerTests.java

@ -644,7 +644,7 @@ class AnnotationDrivenEventListenerTests { @@ -644,7 +644,7 @@ class AnnotationDrivenEventListenerTests {
load(OrderedTestListener.class);
OrderedTestListener listener = this.context.getBean(OrderedTestListener.class);
assertThat(listener.order.isEmpty()).isTrue();
assertThat(listener.order).isEmpty();
this.context.publishEvent("whatever");
assertThat(listener.order).contains("first", "second", "third");
}

6
spring-context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java

@ -141,9 +141,9 @@ class ConversionServiceFactoryBeanTests { @@ -141,9 +141,9 @@ class ConversionServiceFactoryBeanTests {
static class ComplexConstructorArgument {
ComplexConstructorArgument(Map<String, Class<?>> map) {
assertThat(map.isEmpty()).isFalse();
assertThat(map.keySet()).element(0).isInstanceOf(String.class);
assertThat(map.values()).element(0).isInstanceOf(Class.class);
assertThat(map).isNotEmpty();
assertThat(map.keySet().iterator().next()).isInstanceOf(String.class);
assertThat(map.values().iterator().next()).isInstanceOf(Class.class);
}
}

2
spring-context/src/test/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessorTests.java

@ -542,7 +542,7 @@ class ScheduledAnnotationBeanPostProcessorTests { @@ -542,7 +542,7 @@ class ScheduledAnnotationBeanPostProcessorTests {
context.refresh();
ScheduledTaskHolder postProcessor = context.getBean("postProcessor", ScheduledTaskHolder.class);
assertThat(postProcessor.getScheduledTasks().isEmpty()).isTrue();
assertThat(postProcessor.getScheduledTasks()).isEmpty();
}
@ParameterizedTest

2
spring-context/src/test/java/org/springframework/validation/DataBinderTests.java

@ -502,7 +502,7 @@ class DataBinderTests { @@ -502,7 +502,7 @@ class DataBinderTests {
LocaleContextHolder.setLocale(Locale.GERMAN);
try {
binder.bind(pvs);
assertThat(tb.getIntegerList().isEmpty()).isTrue();
assertThat(tb.getIntegerList()).isEmpty();
assertThat(binder.getBindingResult().getFieldValue("integerList[0]")).isEqualTo("1x2");
assertThat(binder.getBindingResult().hasFieldErrors("integerList[0]")).isTrue();
}

8
spring-core-test/src/test/java/org/springframework/core/test/tools/ClassFilesTests.java

@ -1,5 +1,5 @@ @@ -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.
@ -40,7 +40,7 @@ class ClassFilesTests { @@ -40,7 +40,7 @@ class ClassFilesTests {
void noneReturnsNone() {
ClassFiles none = ClassFiles.none();
assertThat(none).isNotNull();
assertThat(none.isEmpty()).isTrue();
assertThat(none).isEmpty();
}
@Test
@ -83,13 +83,13 @@ class ClassFilesTests { @@ -83,13 +83,13 @@ class ClassFilesTests {
@Test
void isEmptyWhenEmptyReturnsTrue() {
ClassFiles classFiles = ClassFiles.of();
assertThat(classFiles.isEmpty()).isTrue();
assertThat(classFiles).isEmpty();
}
@Test
void isEmptyWhenNotEmptyReturnsFalse() {
ClassFiles classFiles = ClassFiles.of(CLASS_FILE_1);
assertThat(classFiles.isEmpty()).isFalse();
assertThat(classFiles).isNotEmpty();
}
@Test

8
spring-core-test/src/test/java/org/springframework/core/test/tools/ResourceFilesTests.java

@ -1,5 +1,5 @@ @@ -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.
@ -41,7 +41,7 @@ class ResourceFilesTests { @@ -41,7 +41,7 @@ class ResourceFilesTests {
void noneReturnsNone() {
ResourceFiles none = ResourceFiles.none();
assertThat(none).isNotNull();
assertThat(none.isEmpty()).isTrue();
assertThat(none).isEmpty();
}
@Test
@ -85,13 +85,13 @@ class ResourceFilesTests { @@ -85,13 +85,13 @@ class ResourceFilesTests {
@Test
void isEmptyWhenEmptyReturnsTrue() {
ResourceFiles resourceFiles = ResourceFiles.of();
assertThat(resourceFiles.isEmpty()).isTrue();
assertThat(resourceFiles).isEmpty();
}
@Test
void isEmptyWhenNotEmptyReturnsFalse() {
ResourceFiles resourceFiles = ResourceFiles.of(RESOURCE_FILE_1);
assertThat(resourceFiles.isEmpty()).isFalse();
assertThat(resourceFiles).isNotEmpty();
}
@Test

8
spring-core-test/src/test/java/org/springframework/core/test/tools/SourceFilesTests.java

@ -1,5 +1,5 @@ @@ -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.
@ -41,7 +41,7 @@ class SourceFilesTests { @@ -41,7 +41,7 @@ class SourceFilesTests {
void noneReturnsNone() {
SourceFiles none = SourceFiles.none();
assertThat(none).isNotNull();
assertThat(none.isEmpty()).isTrue();
assertThat(none).isEmpty();
}
@Test
@ -84,13 +84,13 @@ class SourceFilesTests { @@ -84,13 +84,13 @@ class SourceFilesTests {
@Test
void isEmptyWhenEmptyReturnsTrue() {
SourceFiles sourceFiles = SourceFiles.of();
assertThat(sourceFiles.isEmpty()).isTrue();
assertThat(sourceFiles).isEmpty();
}
@Test
void isEmptyWhenNotEmptyReturnsFalse() {
SourceFiles sourceFiles = SourceFiles.of(SOURCE_FILE_1);
assertThat(sourceFiles.isEmpty()).isFalse();
assertThat(sourceFiles).isNotEmpty();
}
@Test

6
spring-core/src/test/java/org/springframework/core/annotation/AnnotatedElementUtilsTests.java

@ -171,8 +171,8 @@ class AnnotatedElementUtilsTests { @@ -171,8 +171,8 @@ class AnnotatedElementUtilsTests {
@Test
void getMetaAnnotationTypesOnNonAnnotatedClass() {
assertThat(getMetaAnnotationTypes(NonAnnotatedClass.class, TransactionalComponent.class).isEmpty()).isTrue();
assertThat(getMetaAnnotationTypes(NonAnnotatedClass.class, TransactionalComponent.class.getName()).isEmpty()).isTrue();
assertThat(getMetaAnnotationTypes(NonAnnotatedClass.class, TransactionalComponent.class)).isEmpty();
assertThat(getMetaAnnotationTypes(NonAnnotatedClass.class, TransactionalComponent.class.getName())).isEmpty();
}
@Test
@ -869,7 +869,7 @@ class AnnotatedElementUtilsTests { @@ -869,7 +869,7 @@ class AnnotatedElementUtilsTests {
void getAllMergedAnnotationsOnClassWithInterface() throws Exception {
Method method = TransactionalServiceImpl.class.getMethod("doIt");
Set<Transactional> allMergedAnnotations = getAllMergedAnnotations(method, Transactional.class);
assertThat(allMergedAnnotations.isEmpty()).isTrue();
assertThat(allMergedAnnotations).isEmpty();
}
@Test

2
spring-core/src/test/java/org/springframework/core/convert/support/CollectionToCollectionConverterTests.java

@ -96,7 +96,7 @@ class CollectionToCollectionConverterTests { @@ -96,7 +96,7 @@ class CollectionToCollectionConverterTests {
@SuppressWarnings("unchecked")
ArrayList<Integer> result = (ArrayList<Integer>) conversionService.convert(list, sourceType, targetType);
assertThat(result.getClass()).isEqualTo(ArrayList.class);
assertThat(result.isEmpty()).isTrue();
assertThat(result).isEmpty();
}
@Test

4
spring-core/src/test/java/org/springframework/util/AntPathMatcherTests.java

@ -628,7 +628,7 @@ class AntPathMatcherTests { @@ -628,7 +628,7 @@ class AntPathMatcherTests {
pathMatcher.match("test" + i, "test");
}
// Cache turned off because it went beyond the threshold
assertThat(pathMatcher.stringMatcherCache.isEmpty()).isTrue();
assertThat(pathMatcher.stringMatcherCache).isEmpty();
}
@Test
@ -680,7 +680,7 @@ class AntPathMatcherTests { @@ -680,7 +680,7 @@ class AntPathMatcherTests {
void cachePatternsSetToFalse() {
pathMatcher.setCachePatterns(false);
match();
assertThat(pathMatcher.stringMatcherCache.isEmpty()).isTrue();
assertThat(pathMatcher.stringMatcherCache).isEmpty();
}
@Test

2
spring-core/src/test/java/org/springframework/util/CollectionUtilsTests.java

@ -217,7 +217,7 @@ class CollectionUtilsTests { @@ -217,7 +217,7 @@ class CollectionUtilsTests {
@Test
void conversionOfEmptyMap() {
MultiValueMap<String, String> asMultiValueMap = CollectionUtils.toMultiValueMap(new HashMap<>());
assertThat(asMultiValueMap.isEmpty()).isTrue();
assertThat(asMultiValueMap).isEmpty();
assertThat(asMultiValueMap).isEmpty();
}

12
spring-core/src/test/java/org/springframework/util/ConcurrentReferenceHashMapTests.java

@ -272,7 +272,7 @@ class ConcurrentReferenceHashMapTests { @@ -272,7 +272,7 @@ class ConcurrentReferenceHashMapTests {
assertThat(this.map.get(123)).isEqualTo("123");
assertThat(this.map.remove(123, "123")).isTrue();
assertThat(this.map.containsKey(123)).isFalse();
assertThat(this.map.isEmpty()).isTrue();
assertThat(this.map).isEmpty();
}
@Test
@ -282,7 +282,7 @@ class ConcurrentReferenceHashMapTests { @@ -282,7 +282,7 @@ class ConcurrentReferenceHashMapTests {
assertThat(this.map.get(123)).isNull();
assertThat(this.map.remove(123, null)).isTrue();
assertThat(this.map.containsKey(123)).isFalse();
assertThat(this.map.isEmpty()).isTrue();
assertThat(this.map).isEmpty();
}
@Test
@ -328,11 +328,11 @@ class ConcurrentReferenceHashMapTests { @@ -328,11 +328,11 @@ class ConcurrentReferenceHashMapTests {
@Test
void shouldSupportIsEmpty() {
assertThat(this.map.isEmpty()).isTrue();
assertThat(this.map).isEmpty();
this.map.put(123, "123");
this.map.put(123, null);
this.map.put(456, "456");
assertThat(this.map.isEmpty()).isFalse();
assertThat(this.map).isNotEmpty();
}
@Test
@ -363,14 +363,14 @@ class ConcurrentReferenceHashMapTests { @@ -363,14 +363,14 @@ class ConcurrentReferenceHashMapTests {
assertThat(this.map.remove(123)).isNull();
assertThat(this.map.remove(456)).isEqualTo("456");
assertThat(this.map.remove(null)).isEqualTo("789");
assertThat(this.map.isEmpty()).isTrue();
assertThat(this.map).isEmpty();
}
@Test
void shouldRemoveWhenKeyIsNotInMap() {
assertThat(this.map.remove(123)).isNull();
assertThat(this.map.remove(null)).isNull();
assertThat(this.map.isEmpty()).isTrue();
assertThat(this.map).isEmpty();
}
@Test

2
spring-core/src/test/java/org/springframework/util/UnmodifiableMultiValueMapTests.java

@ -50,7 +50,7 @@ class UnmodifiableMultiValueMapTests { @@ -50,7 +50,7 @@ class UnmodifiableMultiValueMapTests {
assertThat(map).hasSize(1);
given(mock.isEmpty()).willReturn(false);
assertThat(map.isEmpty()).isFalse();
assertThat(map).isNotEmpty();
given(mock.containsKey("foo")).willReturn(true);
assertThat(map.containsKey("foo")).isTrue();

2
spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java

@ -1449,7 +1449,7 @@ class SpelReproTests extends AbstractExpressionTests { @@ -1449,7 +1449,7 @@ class SpelReproTests extends AbstractExpressionTests {
Expression expression = parser.parseExpression("T(java.util.Arrays).asList('')");
Object value = expression.getValue();
assertThat(value).isInstanceOf(List.class);
assertThat(((List) value).isEmpty()).isTrue();
assertThat(((List) value)).isEmpty();
}
@Test

2
spring-jdbc/src/test/java/org/springframework/jdbc/datasource/DataSourceJtaTransactionTests.java

@ -81,7 +81,7 @@ public class DataSourceJtaTransactionTests { @@ -81,7 +81,7 @@ public class DataSourceJtaTransactionTests {
@AfterEach
public void verifyTransactionSynchronizationManagerState() {
assertThat(TransactionSynchronizationManager.getResourceMap().isEmpty()).isTrue();
assertThat(TransactionSynchronizationManager.getResourceMap()).isEmpty();
assertThat(TransactionSynchronizationManager.isSynchronizationActive()).isFalse();
assertThat(TransactionSynchronizationManager.getCurrentTransactionName()).isNull();
assertThat(TransactionSynchronizationManager.isCurrentTransactionReadOnly()).isFalse();

2
spring-jms/src/test/java/org/springframework/jms/connection/JmsTransactionManagerTests.java

@ -52,7 +52,7 @@ public class JmsTransactionManagerTests { @@ -52,7 +52,7 @@ public class JmsTransactionManagerTests {
@AfterEach
public void verifyTransactionSynchronizationManagerState() {
assertThat(TransactionSynchronizationManager.getResourceMap().isEmpty()).isTrue();
assertThat(TransactionSynchronizationManager.getResourceMap()).isEmpty();
assertThat(TransactionSynchronizationManager.isSynchronizationActive()).isFalse();
}

2
spring-jms/src/test/java/org/springframework/jms/core/JmsTemplateTests.java

@ -241,7 +241,7 @@ class JmsTemplateTests { @@ -241,7 +241,7 @@ class JmsTemplateTests {
TransactionSynchronizationManager.clearSynchronization();
scf.destroy();
}
assertThat(TransactionSynchronizationManager.getResourceMap().isEmpty()).isTrue();
assertThat(TransactionSynchronizationManager.getResourceMap()).isEmpty();
verify(this.connection).start();
if (useTransactedTemplate()) {

2
spring-messaging/src/test/java/org/springframework/messaging/handler/annotation/support/PayloadMethodArgumentResolverTests.java

@ -133,7 +133,7 @@ public class PayloadMethodArgumentResolverTests { @@ -133,7 +133,7 @@ public class PayloadMethodArgumentResolverTests {
Message<?> emptyStringMessage = MessageBuilder.withPayload(" ").build();
assertThat(this.resolver.resolveArgument(this.paramAnnotatedNotRequired, emptyStringMessage)).isNull();
assertThat(((Optional<?>) this.resolver.resolveArgument(this.paramOptional, emptyStringMessage)).isEmpty()).isTrue();
assertThat(((Optional<?>) this.resolver.resolveArgument(this.paramOptional, emptyStringMessage))).isEmpty();
Message<?> emptyOptionalMessage = MessageBuilder.withPayload(Optional.empty()).build();
assertThat(this.resolver.resolveArgument(this.paramAnnotatedNotRequired, emptyOptionalMessage)).isNull();

2
spring-orm/src/test/java/org/springframework/orm/jpa/ContainerManagedEntityManagerIntegrationTests.java

@ -74,7 +74,7 @@ public class ContainerManagedEntityManagerIntegrationTests extends AbstractEntit @@ -74,7 +74,7 @@ public class ContainerManagedEntityManagerIntegrationTests extends AbstractEntit
assertThat(Proxy.isProxyClass(em.getClass())).isTrue();
Query q = em.createQuery("select p from Person as p");
List<Person> people = q.getResultList();
assertThat(people.isEmpty()).isTrue();
assertThat(people).isEmpty();
assertThat(em.isOpen()).as("Should be open to start with").isTrue();
assertThatIllegalStateException().as("Close should not work on container managed EM").isThrownBy(

4
spring-orm/src/test/java/org/springframework/orm/jpa/EntityManagerFactoryUtilsTests.java

@ -60,7 +60,7 @@ public class EntityManagerFactoryUtilsTests { @@ -60,7 +60,7 @@ public class EntityManagerFactoryUtilsTests {
// no tx active
assertThat(EntityManagerFactoryUtils.doGetTransactionalEntityManager(factory, null)).isNull();
assertThat(TransactionSynchronizationManager.getResourceMap().isEmpty()).isTrue();
assertThat(TransactionSynchronizationManager.getResourceMap()).isEmpty();
}
@Test
@ -80,7 +80,7 @@ public class EntityManagerFactoryUtilsTests { @@ -80,7 +80,7 @@ public class EntityManagerFactoryUtilsTests {
TransactionSynchronizationManager.clearSynchronization();
}
assertThat(TransactionSynchronizationManager.getResourceMap().isEmpty()).isTrue();
assertThat(TransactionSynchronizationManager.getResourceMap()).isEmpty();
}
@Test

2
spring-orm/src/test/java/org/springframework/orm/jpa/support/OpenEntityManagerInViewTests.java

@ -83,7 +83,7 @@ public class OpenEntityManagerInViewTests { @@ -83,7 +83,7 @@ public class OpenEntityManagerInViewTests {
@AfterEach
public void tearDown() {
assertThat(TransactionSynchronizationManager.getResourceMap().isEmpty()).isTrue();
assertThat(TransactionSynchronizationManager.getResourceMap()).isEmpty();
assertThat(TransactionSynchronizationManager.isSynchronizationActive()).isFalse();
assertThat(TransactionSynchronizationManager.isCurrentTransactionReadOnly()).isFalse();
assertThat(TransactionSynchronizationManager.isActualTransactionActive()).isFalse();

4
spring-orm/src/test/java/org/springframework/orm/jpa/support/PersistenceContextTransactionTests.java

@ -70,13 +70,13 @@ class PersistenceContextTransactionTests { @@ -70,13 +70,13 @@ class PersistenceContextTransactionTests {
};
pabpp.postProcessProperties(null, bean, "bean");
assertThat(TransactionSynchronizationManager.getResourceMap().isEmpty()).isTrue();
assertThat(TransactionSynchronizationManager.getResourceMap()).isEmpty();
assertThat(TransactionSynchronizationManager.isSynchronizationActive()).isFalse();
}
@AfterEach
void clear() {
assertThat(TransactionSynchronizationManager.getResourceMap().isEmpty()).isTrue();
assertThat(TransactionSynchronizationManager.getResourceMap()).isEmpty();
assertThat(TransactionSynchronizationManager.isSynchronizationActive()).isFalse();
assertThat(TransactionSynchronizationManager.isCurrentTransactionReadOnly()).isFalse();
assertThat(TransactionSynchronizationManager.isActualTransactionActive()).isFalse();

2
spring-orm/src/test/java/org/springframework/orm/jpa/support/SharedEntityManagerFactoryTests.java

@ -72,7 +72,7 @@ public class SharedEntityManagerFactoryTests { @@ -72,7 +72,7 @@ public class SharedEntityManagerFactoryTests {
TransactionSynchronizationManager.unbindResource(mockEmf);
}
assertThat(TransactionSynchronizationManager.getResourceMap().isEmpty()).isTrue();
assertThat(TransactionSynchronizationManager.getResourceMap()).isEmpty();
verify(mockEm).contains(o);
verify(mockEm).close();
}

2
spring-test/src/test/java/org/springframework/mock/web/MockMultipartHttpServletRequestTests.java

@ -49,7 +49,7 @@ class MockMultipartHttpServletRequestTests { @@ -49,7 +49,7 @@ class MockMultipartHttpServletRequestTests {
assertThat(request.getFileNames().hasNext()).isFalse();
assertThat(request.getFile("file1")).isNull();
assertThat(request.getFile("file2")).isNull();
assertThat(request.getFileMap().isEmpty()).isTrue();
assertThat(request.getFileMap()).isEmpty();
request.addFile(new MockMultipartFile("file1", "myContent1".getBytes()));
request.addFile(new MockMultipartFile("file2", "myOrigFilename", TEXT_PLAIN_VALUE, "myContent2".getBytes()));

2
spring-tx/src/test/java/org/springframework/transaction/JndiJtaTransactionManagerTests.java

@ -219,7 +219,7 @@ public class JndiJtaTransactionManagerTests { @@ -219,7 +219,7 @@ public class JndiJtaTransactionManagerTests {
*/
@AfterEach
public void tearDown() {
assertThat(TransactionSynchronizationManager.getResourceMap().isEmpty()).isTrue();
assertThat(TransactionSynchronizationManager.getResourceMap()).isEmpty();
assertThat(TransactionSynchronizationManager.isSynchronizationActive()).isFalse();
assertThat(TransactionSynchronizationManager.getCurrentTransactionName()).isNull();
assertThat(TransactionSynchronizationManager.isCurrentTransactionReadOnly()).isFalse();

2
spring-tx/src/test/java/org/springframework/transaction/JtaTransactionManagerTests.java

@ -1296,7 +1296,7 @@ public class JtaTransactionManagerTests { @@ -1296,7 +1296,7 @@ public class JtaTransactionManagerTests {
*/
@AfterEach
public void tearDown() {
assertThat(TransactionSynchronizationManager.getResourceMap().isEmpty()).isTrue();
assertThat(TransactionSynchronizationManager.getResourceMap()).isEmpty();
assertThat(TransactionSynchronizationManager.isSynchronizationActive()).isFalse();
assertThat(TransactionSynchronizationManager.getCurrentTransactionName()).isNull();
assertThat(TransactionSynchronizationManager.isCurrentTransactionReadOnly()).isFalse();

4
spring-tx/src/test/java/org/springframework/transaction/support/SimpleTransactionScopeTests.java

@ -1,5 +1,5 @@ @@ -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.
@ -98,7 +98,7 @@ public class SimpleTransactionScopeTests { @@ -98,7 +98,7 @@ public class SimpleTransactionScopeTests {
assertThat(bean2a.wasDestroyed()).isFalse();
assertThat(bean2b.wasDestroyed()).isTrue();
assertThat(TransactionSynchronizationManager.getResourceMap().isEmpty()).isTrue();
assertThat(TransactionSynchronizationManager.getResourceMap()).isEmpty();
assertThatExceptionOfType(BeanCreationException.class).isThrownBy(() ->
context.getBean(TestBean.class))

4
spring-web/src/test/java/org/springframework/http/HttpEntityTests.java

@ -1,5 +1,5 @@ @@ -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.
@ -35,7 +35,7 @@ public class HttpEntityTests { @@ -35,7 +35,7 @@ public class HttpEntityTests {
String body = "foo";
HttpEntity<String> entity = new HttpEntity<>(body);
assertThat(entity.getBody()).isSameAs(body);
assertThat(entity.getHeaders().isEmpty()).isTrue();
assertThat(entity.getHeaders()).isEmpty();
}
@Test

14
spring-web/src/test/java/org/springframework/http/HttpHeadersTests.java

@ -587,7 +587,7 @@ public class HttpHeadersTests { @@ -587,7 +587,7 @@ public class HttpHeadersTests {
// here to check the behavior of the entire contract.
// isEmpty() and size()
assertThat(keySet.isEmpty()).isFalse();
assertThat(keySet).isNotEmpty();
assertThat(keySet).hasSize(2);
// contains()
@ -618,9 +618,9 @@ public class HttpHeadersTests { @@ -618,9 +618,9 @@ public class HttpHeadersTests {
// clear()
keySet.clear();
assertThat(keySet.isEmpty()).isTrue();
assertThat(keySet).isEmpty();
assertThat(headers.isEmpty()).isTrue();
assertThat(keySet).isEmpty();
assertThat(headers).isEmpty();
assertThat(headers).isEmpty();
// Unsupported operations
@ -665,11 +665,11 @@ public class HttpHeadersTests { @@ -665,11 +665,11 @@ public class HttpHeadersTests {
String headerName = "MyHeader";
String headerValue = "value";
assertThat(headers.isEmpty()).isTrue();
assertThat(headers).isEmpty();
headers.add(headerName, headerValue);
assertThat(headers.containsKey(headerName)).isTrue();
headers.keySet().removeIf(key -> key.equals(headerName));
assertThat(headers.isEmpty()).isTrue();
assertThat(headers).isEmpty();
headers.add(headerName, headerValue);
assertThat(headers.get(headerName)).element(0).isEqualTo(headerValue);
}
@ -679,11 +679,11 @@ public class HttpHeadersTests { @@ -679,11 +679,11 @@ public class HttpHeadersTests {
String headerName = "MyHeader";
String headerValue = "value";
assertThat(headers.isEmpty()).isTrue();
assertThat(headers).isEmpty();
headers.add(headerName, headerValue);
assertThat(headers.containsKey(headerName)).isTrue();
headers.entrySet().removeIf(entry -> entry.getKey().equals(headerName));
assertThat(headers.isEmpty()).isTrue();
assertThat(headers).isEmpty();
headers.add(headerName, headerValue);
assertThat(headers.get(headerName)).element(0).isEqualTo(headerValue);
}

2
spring-web/src/test/java/org/springframework/http/MediaTypeFactoryTests.java

@ -39,7 +39,7 @@ public class MediaTypeFactoryTests { @@ -39,7 +39,7 @@ public class MediaTypeFactoryTests {
public void nullParameter() {
assertThat(MediaTypeFactory.getMediaType((String) null)).isNotPresent();
assertThat(MediaTypeFactory.getMediaType((Resource) null)).isNotPresent();
assertThat(MediaTypeFactory.getMediaTypes(null).isEmpty()).isTrue();
assertThat(MediaTypeFactory.getMediaTypes(null)).isEmpty();
}
}

2
spring-web/src/test/java/org/springframework/http/ResponseEntityTests.java

@ -250,7 +250,7 @@ class ResponseEntityTests { @@ -250,7 +250,7 @@ class ResponseEntityTests {
ResponseEntity.ok().headers((HttpHeaders) null).build();
assertThat(responseEntityWithEmptyHeaders.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(responseEntityWithEmptyHeaders.getHeaders().isEmpty()).isTrue();
assertThat(responseEntityWithEmptyHeaders.getHeaders()).isEmpty();
assertThat(responseEntityWithNullHeaders.toString()).isEqualTo(responseEntityWithEmptyHeaders.toString());
}

6
spring-web/src/test/java/org/springframework/http/server/reactive/ServerHttpResponseTests.java

@ -112,7 +112,7 @@ class ServerHttpResponseTests { @@ -112,7 +112,7 @@ class ServerHttpResponseTests {
assertThat(response.cookiesWritten).isFalse();
assertThat(headers).doesNotContainKeys(HttpHeaders.CONTENT_TYPE, HttpHeaders.CONTENT_LENGTH,
HttpHeaders.CONTENT_ENCODING);
assertThat(response.body.isEmpty()).isTrue();
assertThat(response.body).isEmpty();
}
@Test
@ -123,7 +123,7 @@ class ServerHttpResponseTests { @@ -123,7 +123,7 @@ class ServerHttpResponseTests {
assertThat(response.statusCodeWritten).isTrue();
assertThat(response.headersWritten).isTrue();
assertThat(response.cookiesWritten).isTrue();
assertThat(response.body.isEmpty()).isTrue();
assertThat(response.body).isEmpty();
}
@Test
@ -157,7 +157,7 @@ class ServerHttpResponseTests { @@ -157,7 +157,7 @@ class ServerHttpResponseTests {
assertThat(response.statusCodeWritten).isTrue();
assertThat(response.headersWritten).isTrue();
assertThat(response.cookiesWritten).isTrue();
assertThat(response.body.isEmpty()).isTrue();
assertThat(response.body).isEmpty();
assertThat(response.getCookies().getFirst("ID")).isSameAs(cookie);
}

4
spring-web/src/test/java/org/springframework/web/method/support/ModelAndViewContainerTests.java

@ -1,5 +1,5 @@ @@ -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.
@ -73,7 +73,7 @@ public class ModelAndViewContainerTests { @@ -73,7 +73,7 @@ public class ModelAndViewContainerTests {
this.mavContainer.addAttribute("name", "value");
this.mavContainer.setRedirectModelScenario(true);
assertThat(this.mavContainer.getModel().isEmpty()).isTrue();
assertThat(this.mavContainer.getModel()).isEmpty();
}
@Test // SPR-14045

2
spring-web/src/test/java/org/springframework/web/util/ContentCachingRequestWrapperTests.java

@ -112,7 +112,7 @@ public class ContentCachingRequestWrapperTests { @@ -112,7 +112,7 @@ public class ContentCachingRequestWrapperTests {
ContentCachingRequestWrapper wrapper = new ContentCachingRequestWrapper(request);
// getting request parameters will consume the request body
assertThat(wrapper.getParameterMap().isEmpty()).isFalse();
assertThat(wrapper.getParameterMap()).isNotEmpty();
assertThat(new String(wrapper.getContentAsByteArray())).isEqualTo("first=value&second=foo&second=bar");
// SPR-12810 : inputstream body should be consumed
assertThat(new String(wrapper.getInputStream().readAllBytes())).isEmpty();

4
spring-web/src/test/java/org/springframework/web/util/UriComponentsBuilderTests.java

@ -772,8 +772,8 @@ class UriComponentsBuilderTests { @@ -772,8 +772,8 @@ class UriComponentsBuilderTests {
UriComponents uri1 = UriComponentsBuilder.fromUriString("http://test.com").build().normalize();
UriComponents uri2 = UriComponentsBuilder.fromUriString("http://test.com/").build();
assertThat(uri1.getPathSegments().isEmpty()).isTrue();
assertThat(uri2.getPathSegments().isEmpty()).isTrue();
assertThat(uri1.getPathSegments()).isEmpty();
assertThat(uri2.getPathSegments()).isEmpty();
assertThat(uri2).isNotEqualTo(uri1);
}

4
spring-webflux/src/test/java/org/springframework/web/reactive/config/CorsRegistryTests.java

@ -1,5 +1,5 @@ @@ -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.
@ -38,7 +38,7 @@ public class CorsRegistryTests { @@ -38,7 +38,7 @@ public class CorsRegistryTests {
@Test
public void noMapping() {
assertThat(this.registry.getCorsConfigurations().isEmpty()).isTrue();
assertThat(this.registry.getCorsConfigurations()).isEmpty();
}
@Test

18
spring-webflux/src/test/java/org/springframework/web/reactive/function/client/ExchangeStrategiesTests.java

@ -1,5 +1,5 @@ @@ -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.
@ -28,27 +28,27 @@ public class ExchangeStrategiesTests { @@ -28,27 +28,27 @@ public class ExchangeStrategiesTests {
@Test
public void empty() {
ExchangeStrategies strategies = ExchangeStrategies.empty().build();
assertThat(strategies.messageReaders().isEmpty()).isTrue();
assertThat(strategies.messageWriters().isEmpty()).isTrue();
assertThat(strategies.messageReaders()).isEmpty();
assertThat(strategies.messageWriters()).isEmpty();
}
@Test
public void withDefaults() {
ExchangeStrategies strategies = ExchangeStrategies.withDefaults();
assertThat(strategies.messageReaders().isEmpty()).isFalse();
assertThat(strategies.messageWriters().isEmpty()).isFalse();
assertThat(strategies.messageReaders()).isNotEmpty();
assertThat(strategies.messageWriters()).isNotEmpty();
}
@Test
@SuppressWarnings("deprecation")
public void mutate() {
ExchangeStrategies strategies = ExchangeStrategies.empty().build();
assertThat(strategies.messageReaders().isEmpty()).isTrue();
assertThat(strategies.messageWriters().isEmpty()).isTrue();
assertThat(strategies.messageReaders()).isEmpty();
assertThat(strategies.messageWriters()).isEmpty();
ExchangeStrategies mutated = strategies.mutate().codecs(codecs -> codecs.registerDefaults(true)).build();
assertThat(mutated.messageReaders().isEmpty()).isFalse();
assertThat(mutated.messageWriters().isEmpty()).isFalse();
assertThat(mutated.messageReaders()).isNotEmpty();
assertThat(mutated.messageWriters()).isNotEmpty();
}
}

6
spring-webflux/src/test/java/org/springframework/web/reactive/function/server/DefaultServerResponseBuilderTests.java

@ -1,5 +1,5 @@ @@ -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.
@ -298,13 +298,13 @@ class DefaultServerResponseBuilderTests { @@ -298,13 +298,13 @@ class DefaultServerResponseBuilderTests {
.cookie(ResponseCookie.from("foo", "bar").build())
.bodyValue("body");
assertThat(serverResponse.block().cookies().isEmpty()).isFalse();
assertThat(serverResponse.block().cookies()).isNotEmpty();
serverResponse = ServerResponse.ok()
.cookie(ResponseCookie.from("foo", "bar").build())
.bodyValue("body");
assertThat(serverResponse.block().cookies().isEmpty()).isFalse();
assertThat(serverResponse.block().cookies()).isNotEmpty();
}
@Test

14
spring-webflux/src/test/java/org/springframework/web/reactive/function/server/HandlerStrategiesTests.java

@ -1,5 +1,5 @@ @@ -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.
@ -28,17 +28,17 @@ public class HandlerStrategiesTests { @@ -28,17 +28,17 @@ public class HandlerStrategiesTests {
@Test
public void empty() {
HandlerStrategies strategies = HandlerStrategies.empty().build();
assertThat(strategies.messageReaders().isEmpty()).isTrue();
assertThat(strategies.messageWriters().isEmpty()).isTrue();
assertThat(strategies.viewResolvers().isEmpty()).isTrue();
assertThat(strategies.messageReaders()).isEmpty();
assertThat(strategies.messageWriters()).isEmpty();
assertThat(strategies.viewResolvers()).isEmpty();
}
@Test
public void withDefaults() {
HandlerStrategies strategies = HandlerStrategies.withDefaults();
assertThat(strategies.messageReaders().isEmpty()).isFalse();
assertThat(strategies.messageWriters().isEmpty()).isFalse();
assertThat(strategies.viewResolvers().isEmpty()).isTrue();
assertThat(strategies.messageReaders()).isNotEmpty();
assertThat(strategies.messageWriters()).isNotEmpty();
assertThat(strategies.viewResolvers()).isEmpty();
}
}

6
spring-webmvc/src/test/java/org/springframework/web/servlet/FlashMapTests.java

@ -1,5 +1,5 @@ @@ -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 { @@ -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 { @@ -115,7 +115,7 @@ public class FlashMapTests {
FlashMap flashMap = new FlashMap();
flashMap.addTargetRequestParams(params);
assertThat(flashMap.getTargetRequestParams().isEmpty()).isTrue();
assertThat(flashMap.getTargetRequestParams()).isEmpty();
}
}

4
spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/CorsRegistryTests.java

@ -1,5 +1,5 @@ @@ -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 { @@ -43,7 +43,7 @@ public class CorsRegistryTests {
@Test
public void noMapping() {
assertThat(this.registry.getCorsConfigurations().isEmpty()).isTrue();
assertThat(this.registry.getCorsConfigurations()).isEmpty();
}
@Test

6
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/ParameterizableViewControllerTests.java

@ -1,5 +1,5 @@ @@ -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 { @@ -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

22
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/UrlFilenameViewControllerTests.java

@ -54,7 +54,7 @@ class UrlFilenameViewControllerTests { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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

2
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ModelAndViewMethodReturnValueHandlerTests.java

@ -140,7 +140,7 @@ public class ModelAndViewMethodReturnValueHandlerTests { @@ -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);
}

4
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ModelAndViewResolverMethodReturnValueHandlerTests.java

@ -1,5 +1,5 @@ @@ -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 { @@ -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

6
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletAnnotationControllerHandlerMethodTests.java

@ -1671,7 +1671,7 @@ class ServletAnnotationControllerHandlerMethodTests extends AbstractServletHandl @@ -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 @@ -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 @@ -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

4
spring-websocket/src/test/java/org/springframework/web/socket/config/HandlersBeanDefinitionParserTests.java

@ -97,7 +97,7 @@ public class HandlersBeanDefinitionParserTests { @@ -97,7 +97,7 @@ public class HandlersBeanDefinitionParserTests {
assertThat(handshakeHandler).isNotNull();
boolean condition1 = handshakeHandler instanceof DefaultHandshakeHandler;
assertThat(condition1).isTrue();
assertThat(handler.getHandshakeInterceptors().isEmpty()).isFalse();
assertThat(handler.getHandshakeInterceptors()).isNotEmpty();
boolean condition = handler.getHandshakeInterceptors().get(0) instanceof OriginHandshakeInterceptor;
assertThat(condition).isTrue();
}
@ -110,7 +110,7 @@ public class HandlersBeanDefinitionParserTests { @@ -110,7 +110,7 @@ public class HandlersBeanDefinitionParserTests {
assertThat(handshakeHandler).isNotNull();
boolean condition1 = handshakeHandler instanceof DefaultHandshakeHandler;
assertThat(condition1).isTrue();
assertThat(handler.getHandshakeInterceptors().isEmpty()).isFalse();
assertThat(handler.getHandshakeInterceptors()).isNotEmpty();
boolean condition = handler.getHandshakeInterceptors().get(0) instanceof OriginHandshakeInterceptor;
assertThat(condition).isTrue();
}

2
spring-websocket/src/test/java/org/springframework/web/socket/sockjs/support/SockJsServiceTests.java

@ -192,7 +192,7 @@ class SockJsServiceTests extends AbstractHttpRequestTests { @@ -192,7 +192,7 @@ class SockJsServiceTests extends AbstractHttpRequestTests {
this.servletRequest.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, "Last-Modified");
resetResponseAndHandleRequest("OPTIONS", "/echo/info", HttpStatus.FORBIDDEN);
CorsConfiguration corsConfiguration = this.service.getCorsConfiguration(this.servletRequest);
assertThat(corsConfiguration.getAllowedOrigins().isEmpty()).isTrue();
assertThat(corsConfiguration.getAllowedOrigins()).isEmpty();
this.service.setAllowedOrigins(Collections.singletonList("https://mydomain1.example"));
resetResponseAndHandleRequest("OPTIONS", "/echo/info", HttpStatus.FORBIDDEN);

Loading…
Cancel
Save