Browse Source

Migrate test suite from JUnit 4 to JUnit Jupiter

This first commit for this issue:

- allows JUnit Jupiter to be used for all tests
- adds a dependency on mockito-junit-jupiter
- migrates tests in spring-core to JUnit Jupiter, except parameterized
  tests

The following script was developed in order to semi-automate the
migration process.

https://github.com/sbrannen/junit-converters/blob/master/junit4ToJUnitJupiter.zsh

See gh-23451
pull/23477/head
Sam Brannen 5 years ago
parent
commit
32cc32f9a7
  1. 7
      build.gradle
  2. 2
      spring-core/src/test/java/org/springframework/core/AttributeAccessorSupportTests.java
  3. 2
      spring-core/src/test/java/org/springframework/core/BridgeMethodResolverTests.java
  4. 2
      spring-core/src/test/java/org/springframework/core/CollectionFactoryTests.java
  5. 2
      spring-core/src/test/java/org/springframework/core/ConstantsTests.java
  6. 2
      spring-core/src/test/java/org/springframework/core/ConventionsTests.java
  7. 2
      spring-core/src/test/java/org/springframework/core/ExceptionDepthComparatorTests.java
  8. 2
      spring-core/src/test/java/org/springframework/core/GenericTypeResolverTests.java
  9. 2
      spring-core/src/test/java/org/springframework/core/LocalVariableTableParameterNameDiscovererTests.java
  10. 6
      spring-core/src/test/java/org/springframework/core/MethodParameterTests.java
  11. 2
      spring-core/src/test/java/org/springframework/core/NestedExceptionTests.java
  12. 2
      spring-core/src/test/java/org/springframework/core/OrderComparatorTests.java
  13. 2
      spring-core/src/test/java/org/springframework/core/ParameterizedTypeReferenceTests.java
  14. 2
      spring-core/src/test/java/org/springframework/core/PrioritizedParameterNameDiscovererTests.java
  15. 2
      spring-core/src/test/java/org/springframework/core/ReactiveAdapterRegistryTests.java
  16. 8
      spring-core/src/test/java/org/springframework/core/ResolvableTypeTests.java
  17. 2
      spring-core/src/test/java/org/springframework/core/SerializableTypeWrapperTests.java
  18. 2
      spring-core/src/test/java/org/springframework/core/SimpleAliasRegistryTests.java
  19. 2
      spring-core/src/test/java/org/springframework/core/SortedPropertiesTests.java
  20. 6
      spring-core/src/test/java/org/springframework/core/StandardReflectionParameterNameDiscoverTests.java
  21. 6
      spring-core/src/test/java/org/springframework/core/annotation/AnnotatedElementUtilsTests.java
  22. 2
      spring-core/src/test/java/org/springframework/core/annotation/AnnotationAttributesTests.java
  23. 2
      spring-core/src/test/java/org/springframework/core/annotation/AnnotationAwareOrderComparatorTests.java
  24. 2
      spring-core/src/test/java/org/springframework/core/annotation/AnnotationBackCompatibiltyTests.java
  25. 2
      spring-core/src/test/java/org/springframework/core/annotation/AnnotationFilterTests.java
  26. 2
      spring-core/src/test/java/org/springframework/core/annotation/AnnotationIntrospectionFailureTests.java
  27. 2
      spring-core/src/test/java/org/springframework/core/annotation/AnnotationTypeMappingsTests.java
  28. 6
      spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java
  29. 2
      spring-core/src/test/java/org/springframework/core/annotation/AnnotationsScannerTests.java
  30. 2
      spring-core/src/test/java/org/springframework/core/annotation/AttributeMethodsTests.java
  31. 2
      spring-core/src/test/java/org/springframework/core/annotation/ComposedRepeatableAnnotationsTests.java
  32. 2
      spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationClassLoaderTests.java
  33. 2
      spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationCollectorsTests.java
  34. 2
      spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationPredicatesTests.java
  35. 2
      spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationsCollectionTests.java
  36. 2
      spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationsComposedOnSingleAnnotatedElementTests.java
  37. 2
      spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationsRepeatableAnnotationTests.java
  38. 2
      spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationsTests.java
  39. 2
      spring-core/src/test/java/org/springframework/core/annotation/MissingMergedAnnotationTests.java
  40. 6
      spring-core/src/test/java/org/springframework/core/annotation/MultipleComposedAnnotationsOnSingleAnnotatedElementTests.java
  41. 2
      spring-core/src/test/java/org/springframework/core/annotation/OrderSourceProviderTests.java
  42. 2
      spring-core/src/test/java/org/springframework/core/annotation/OrderUtilsTests.java
  43. 2
      spring-core/src/test/java/org/springframework/core/annotation/PackagesAnnotationFilterTests.java
  44. 2
      spring-core/src/test/java/org/springframework/core/annotation/RepeatableContainersTests.java
  45. 6
      spring-core/src/test/java/org/springframework/core/annotation/SynthesizingMethodParameterTests.java
  46. 2
      spring-core/src/test/java/org/springframework/core/annotation/TypeMappedAnnotationTests.java
  47. 2
      spring-core/src/test/java/org/springframework/core/codec/AbstractDecoderTestCase.java
  48. 2
      spring-core/src/test/java/org/springframework/core/codec/AbstractEncoderTestCase.java
  49. 2
      spring-core/src/test/java/org/springframework/core/codec/ByteArrayDecoderTests.java
  50. 2
      spring-core/src/test/java/org/springframework/core/codec/ByteArrayEncoderTests.java
  51. 2
      spring-core/src/test/java/org/springframework/core/codec/ByteBufferDecoderTests.java
  52. 2
      spring-core/src/test/java/org/springframework/core/codec/ByteBufferEncoderTests.java
  53. 2
      spring-core/src/test/java/org/springframework/core/codec/CharSequenceEncoderTests.java
  54. 2
      spring-core/src/test/java/org/springframework/core/codec/DataBufferDecoderTests.java
  55. 2
      spring-core/src/test/java/org/springframework/core/codec/DataBufferEncoderTests.java
  56. 2
      spring-core/src/test/java/org/springframework/core/codec/ResourceDecoderTests.java
  57. 2
      spring-core/src/test/java/org/springframework/core/codec/ResourceEncoderTests.java
  58. 6
      spring-core/src/test/java/org/springframework/core/codec/ResourceRegionEncoderTests.java
  59. 2
      spring-core/src/test/java/org/springframework/core/codec/StringDecoderTests.java
  60. 2
      spring-core/src/test/java/org/springframework/core/convert/TypeDescriptorTests.java
  61. 2
      spring-core/src/test/java/org/springframework/core/convert/converter/ConvertingComparatorTests.java
  62. 2
      spring-core/src/test/java/org/springframework/core/convert/converter/DefaultConversionServiceTests.java
  63. 6
      spring-core/src/test/java/org/springframework/core/convert/support/ByteBufferConverterTests.java
  64. 6
      spring-core/src/test/java/org/springframework/core/convert/support/CollectionToCollectionConverterTests.java
  65. 2
      spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java
  66. 6
      spring-core/src/test/java/org/springframework/core/convert/support/MapToMapConverterTests.java
  67. 6
      spring-core/src/test/java/org/springframework/core/convert/support/StreamConverterTests.java
  68. 2
      spring-core/src/test/java/org/springframework/core/env/CompositePropertySourceTests.java
  69. 2
      spring-core/src/test/java/org/springframework/core/env/CustomEnvironmentTests.java
  70. 2
      spring-core/src/test/java/org/springframework/core/env/JOptCommandLinePropertySourceTests.java
  71. 2
      spring-core/src/test/java/org/springframework/core/env/MutablePropertySourcesTests.java
  72. 2
      spring-core/src/test/java/org/springframework/core/env/ProfilesTests.java
  73. 2
      spring-core/src/test/java/org/springframework/core/env/PropertySourceTests.java
  74. 6
      spring-core/src/test/java/org/springframework/core/env/PropertySourcesPropertyResolverTests.java
  75. 2
      spring-core/src/test/java/org/springframework/core/env/SimpleCommandLineParserTests.java
  76. 2
      spring-core/src/test/java/org/springframework/core/env/SimpleCommandLinePropertySourceTests.java
  77. 2
      spring-core/src/test/java/org/springframework/core/env/StandardEnvironmentTests.java
  78. 6
      spring-core/src/test/java/org/springframework/core/env/SystemEnvironmentPropertySourceTests.java
  79. 2
      spring-core/src/test/java/org/springframework/core/io/ClassPathResourceTests.java
  80. 24
      spring-core/src/test/java/org/springframework/core/io/PathResourceTests.java
  81. 2
      spring-core/src/test/java/org/springframework/core/io/ResourceEditorTests.java
  82. 2
      spring-core/src/test/java/org/springframework/core/io/ResourceTests.java
  83. 4
      spring-core/src/test/java/org/springframework/core/io/buffer/AbstractLeakCheckingTestCase.java
  84. 12
      spring-core/src/test/java/org/springframework/core/io/buffer/LeakAwareDataBufferFactory.java
  85. 2
      spring-core/src/test/java/org/springframework/core/io/buffer/LeakAwareDataBufferFactoryTests.java
  86. 2
      spring-core/src/test/java/org/springframework/core/io/support/EncodedResourceTests.java
  87. 6
      spring-core/src/test/java/org/springframework/core/io/support/PathMatchingResourcePatternResolverTests.java
  88. 2
      spring-core/src/test/java/org/springframework/core/io/support/ResourceArrayPropertyEditorTests.java
  89. 2
      spring-core/src/test/java/org/springframework/core/io/support/ResourcePropertySourceTests.java
  90. 2
      spring-core/src/test/java/org/springframework/core/io/support/ResourceRegionTests.java
  91. 2
      spring-core/src/test/java/org/springframework/core/io/support/SpringFactoriesLoaderTests.java
  92. 2
      spring-core/src/test/java/org/springframework/core/log/LogSupportTests.java
  93. 2
      spring-core/src/test/java/org/springframework/core/serializer/SerializationConverterTests.java
  94. 2
      spring-core/src/test/java/org/springframework/core/style/DefaultValueStylerTests.java
  95. 6
      spring-core/src/test/java/org/springframework/core/style/ToStringCreatorTests.java
  96. 2
      spring-core/src/test/java/org/springframework/core/task/SimpleAsyncTaskExecutorTests.java
  97. 2
      spring-core/src/test/java/org/springframework/core/type/AbstractAnnotationMetadataTests.java
  98. 2
      spring-core/src/test/java/org/springframework/core/type/AbstractClassMetadataMemberClassTests.java
  99. 2
      spring-core/src/test/java/org/springframework/core/type/AbstractMethodMetadataTests.java
  100. 2
      spring-core/src/test/java/org/springframework/core/type/AnnotationMetadataTests.java
  101. Some files were not shown because too many files have changed in this diff Show More

7
build.gradle

@ -136,18 +136,21 @@ configure(allprojects) { project -> @@ -136,18 +136,21 @@ configure(allprojects) { project ->
}
dependencies {
testCompile("org.junit.jupiter:junit-jupiter-api")
testCompile("org.junit.jupiter:junit-jupiter-params")
testCompile("junit:junit:4.13-beta-3") {
exclude group: "org.hamcrest", module: "hamcrest-core"
}
testCompile("org.mockito:mockito-core:3.0.0") {
exclude group: "org.hamcrest", module: "hamcrest-core"
}
testCompile("org.mockito:mockito-junit-jupiter:3.0.0")
testCompile("io.mockk:mockk:1.9.3")
testCompile("org.hamcrest:hamcrest-all:1.3")
testCompile("org.assertj:assertj-core:3.13.1")
// Pull in the latest JUnit 5 Launcher API and the Vintage engine as well
// so that we can run JUnit 4 tests in IDEs.
// Pull in the latest JUnit 5 Launcher API to ensure proper support in IDEs.
testRuntime("org.junit.platform:junit-platform-launcher")
testRuntime("org.junit.jupiter:junit-jupiter-engine")
testRuntime("org.junit.vintage:junit-vintage-engine")
testRuntime("org.apache.logging.log4j:log4j-core:${log4jVersion}")
testRuntime("org.apache.logging.log4j:log4j-slf4j-impl:${log4jVersion}")

2
spring-core/src/test/java/org/springframework/core/AttributeAccessorSupportTests.java

@ -18,7 +18,7 @@ package org.springframework.core; @@ -18,7 +18,7 @@ package org.springframework.core;
import java.util.Arrays;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

2
spring-core/src/test/java/org/springframework/core/BridgeMethodResolverTests.java

@ -28,7 +28,7 @@ import java.util.Map; @@ -28,7 +28,7 @@ import java.util.Map;
import java.util.concurrent.DelayQueue;
import java.util.concurrent.Delayed;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.util.ReflectionUtils;

2
spring-core/src/test/java/org/springframework/core/CollectionFactoryTests.java

@ -35,7 +35,7 @@ import java.util.TreeMap; @@ -35,7 +35,7 @@ import java.util.TreeMap;
import java.util.TreeSet;
import org.assertj.core.api.Assertions;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;

2
spring-core/src/test/java/org/springframework/core/ConstantsTests.java

@ -19,7 +19,7 @@ package org.springframework.core; @@ -19,7 +19,7 @@ package org.springframework.core;
import java.util.Locale;
import java.util.Set;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

2
spring-core/src/test/java/org/springframework/core/ConventionsTests.java

@ -25,7 +25,7 @@ import java.util.Set; @@ -25,7 +25,7 @@ import java.util.Set;
import io.reactivex.Observable;
import io.reactivex.Single;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

2
spring-core/src/test/java/org/springframework/core/ExceptionDepthComparatorTests.java

@ -18,7 +18,7 @@ package org.springframework.core; @@ -18,7 +18,7 @@ package org.springframework.core;
import java.util.Arrays;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

2
spring-core/src/test/java/org/springframework/core/GenericTypeResolverTests.java

@ -25,7 +25,7 @@ import java.util.HashMap; @@ -25,7 +25,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.core.GenericTypeResolver.getTypeVariableMap;

2
spring-core/src/test/java/org/springframework/core/LocalVariableTableParameterNameDiscovererTests.java

@ -23,7 +23,7 @@ import java.lang.reflect.Method; @@ -23,7 +23,7 @@ import java.lang.reflect.Method;
import java.util.Date;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.tests.sample.objects.TestObject;

6
spring-core/src/test/java/org/springframework/core/MethodParameterTests.java

@ -25,8 +25,8 @@ import java.lang.reflect.Method; @@ -25,8 +25,8 @@ import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.concurrent.Callable;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
@ -50,7 +50,7 @@ public class MethodParameterTests { @@ -50,7 +50,7 @@ public class MethodParameterTests {
private MethodParameter intReturnType;
@Before
@BeforeEach
public void setup() throws NoSuchMethodException {
method = getClass().getMethod("method", String.class, Long.TYPE);
stringParameter = new MethodParameter(method, 0);

2
spring-core/src/test/java/org/springframework/core/NestedExceptionTests.java

@ -19,7 +19,7 @@ package org.springframework.core; @@ -19,7 +19,7 @@ package org.springframework.core;
import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

2
spring-core/src/test/java/org/springframework/core/OrderComparatorTests.java

@ -18,7 +18,7 @@ package org.springframework.core; @@ -18,7 +18,7 @@ package org.springframework.core;
import java.util.Comparator;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

2
spring-core/src/test/java/org/springframework/core/ParameterizedTypeReferenceTests.java

@ -20,7 +20,7 @@ import java.lang.reflect.Type; @@ -20,7 +20,7 @@ import java.lang.reflect.Type;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

2
spring-core/src/test/java/org/springframework/core/PrioritizedParameterNameDiscovererTests.java

@ -20,7 +20,7 @@ import java.lang.reflect.Constructor; @@ -20,7 +20,7 @@ import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.Arrays;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.tests.sample.objects.TestObject;

2
spring-core/src/test/java/org/springframework/core/ReactiveAdapterRegistryTests.java

@ -24,7 +24,7 @@ import java.util.concurrent.CompletableFuture; @@ -24,7 +24,7 @@ import java.util.concurrent.CompletableFuture;
import io.reactivex.Flowable;
import io.reactivex.Maybe;
import kotlinx.coroutines.Deferred;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;
import reactor.core.publisher.FluxProcessor;

8
spring-core/src/test/java/org/springframework/core/ResolvableTypeTests.java

@ -43,11 +43,11 @@ import java.util.TreeSet; @@ -43,11 +43,11 @@ import java.util.TreeSet;
import java.util.concurrent.Callable;
import org.assertj.core.api.AbstractAssert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.core.ResolvableType.VariableResolver;
import org.springframework.util.MultiValueMap;
@ -68,7 +68,7 @@ import static org.mockito.Mockito.verify; @@ -68,7 +68,7 @@ import static org.mockito.Mockito.verify;
* @author Sebastien Deleuze
*/
@SuppressWarnings("rawtypes")
@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
public class ResolvableTypeTests {
@Captor

2
spring-core/src/test/java/org/springframework/core/SerializableTypeWrapperTests.java

@ -29,7 +29,7 @@ import java.lang.reflect.TypeVariable; @@ -29,7 +29,7 @@ import java.lang.reflect.TypeVariable;
import java.lang.reflect.WildcardType;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

2
spring-core/src/test/java/org/springframework/core/SimpleAliasRegistryTests.java

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
package org.springframework.core;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

2
spring-core/src/test/java/org/springframework/core/SortedPropertiesTests.java

@ -23,7 +23,7 @@ import java.nio.charset.StandardCharsets; @@ -23,7 +23,7 @@ import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.Properties;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static java.util.Arrays.stream;
import static org.assertj.core.api.Assertions.assertThat;

6
spring-core/src/test/java/org/springframework/core/StandardReflectionParameterNameDiscoverTests.java

@ -17,8 +17,8 @@ package org.springframework.core; @@ -17,8 +17,8 @@ package org.springframework.core;
import java.lang.reflect.Method;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.util.ReflectionUtils;
@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat; @@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class StandardReflectionParameterNameDiscoverTests {
private ParameterNameDiscoverer parameterNameDiscoverer;
@Before
@BeforeEach
public void setup() {
parameterNameDiscoverer = new StandardReflectionParameterNameDiscoverer();
}

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

@ -34,8 +34,8 @@ import javax.annotation.ParametersAreNonnullByDefault; @@ -34,8 +34,8 @@ import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.Resource;
import javax.annotation.meta.When;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.core.annotation.AnnotationUtilsTests.ExtendsBaseClassWithGenericAnnotatedMethod;
import org.springframework.core.annotation.AnnotationUtilsTests.ImplementsInterfaceWithGenericAnnotatedMethod;
@ -384,7 +384,7 @@ public class AnnotatedElementUtilsTests { @@ -384,7 +384,7 @@ public class AnnotatedElementUtilsTests {
* the first test class or the second one (with different exceptions), depending
* on the order in which the JVM returns the attribute methods via reflection.
*/
@Ignore("Permanently disabled but left in place for illustrative purposes")
@Disabled("Permanently disabled but left in place for illustrative purposes")
@Test
public void getMergedAnnotationAttributesWithHalfConventionBasedAndHalfAliasedComposedAnnotation() {
for (Class<?> clazz : asList(HalfConventionBasedAndHalfAliasedComposedContextConfigClassV1.class,

2
spring-core/src/test/java/org/springframework/core/annotation/AnnotationAttributesTests.java

@ -21,7 +21,7 @@ import java.lang.annotation.RetentionPolicy; @@ -21,7 +21,7 @@ import java.lang.annotation.RetentionPolicy;
import java.util.Arrays;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.annotation.AnnotationUtilsTests.ImplicitAliasesContextConfig;

2
spring-core/src/test/java/org/springframework/core/annotation/AnnotationAwareOrderComparatorTests.java

@ -20,7 +20,7 @@ import java.util.ArrayList; @@ -20,7 +20,7 @@ import java.util.ArrayList;
import java.util.List;
import javax.annotation.Priority;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

2
spring-core/src/test/java/org/springframework/core/annotation/AnnotationBackCompatibiltyTests.java

@ -19,7 +19,7 @@ package org.springframework.core.annotation; @@ -19,7 +19,7 @@ package org.springframework.core.annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

2
spring-core/src/test/java/org/springframework/core/annotation/AnnotationFilterTests.java

@ -20,7 +20,7 @@ import java.lang.annotation.Retention; @@ -20,7 +20,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import javax.annotation.Nonnull;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils;

2
spring-core/src/test/java/org/springframework/core/annotation/AnnotationIntrospectionFailureTests.java

@ -21,7 +21,7 @@ import java.lang.annotation.Retention; @@ -21,7 +21,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.Method;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.OverridingClassLoader;
import org.springframework.util.ClassUtils;

2
spring-core/src/test/java/org/springframework/core/annotation/AnnotationTypeMappingsTests.java

@ -30,7 +30,7 @@ import java.util.List; @@ -30,7 +30,7 @@ import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.annotation.AnnotationTypeMapping.MirrorSets;
import org.springframework.core.annotation.AnnotationTypeMapping.MirrorSets.MirrorSet;

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

@ -32,8 +32,8 @@ import java.util.Set; @@ -32,8 +32,8 @@ import java.util.Set;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.subpackage.NonPublicAnnotatedClass;
@ -74,7 +74,7 @@ import static org.springframework.core.annotation.AnnotationUtils.synthesizeAnno @@ -74,7 +74,7 @@ import static org.springframework.core.annotation.AnnotationUtils.synthesizeAnno
@SuppressWarnings("deprecation")
public class AnnotationUtilsTests {
@Before
@BeforeEach
public void clearCacheBeforeTests() {
AnnotationUtils.clearCache();
}

2
spring-core/src/test/java/org/springframework/core/annotation/AnnotationsScannerTests.java

@ -28,7 +28,7 @@ import java.util.Arrays; @@ -28,7 +28,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.annotation.MergedAnnotations.SearchStrategy;
import org.springframework.lang.Nullable;

2
spring-core/src/test/java/org/springframework/core/annotation/AttributeMethodsTests.java

@ -24,7 +24,7 @@ import java.lang.reflect.Method; @@ -24,7 +24,7 @@ import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;

2
spring-core/src/test/java/org/springframework/core/annotation/ComposedRepeatableAnnotationsTests.java

@ -27,7 +27,7 @@ import java.util.Iterator; @@ -27,7 +27,7 @@ import java.util.Iterator;
import java.util.Set;
import org.assertj.core.api.ThrowableAssert.ThrowingCallable;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

2
spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationClassLoaderTests.java

@ -21,7 +21,7 @@ import java.lang.annotation.Retention; @@ -21,7 +21,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.Method;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.OverridingClassLoader;

2
spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationCollectorsTests.java

@ -25,7 +25,7 @@ import java.util.LinkedHashSet; @@ -25,7 +25,7 @@ import java.util.LinkedHashSet;
import java.util.Set;
import java.util.stream.Stream;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.annotation.MergedAnnotation.Adapt;
import org.springframework.util.MultiValueMap;

2
spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationPredicatesTests.java

@ -24,7 +24,7 @@ import java.util.Collections; @@ -24,7 +24,7 @@ import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;

2
spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationsCollectionTests.java

@ -24,7 +24,7 @@ import java.util.Collections; @@ -24,7 +24,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Spliterator;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;

2
spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationsComposedOnSingleAnnotatedElementTests.java

@ -27,7 +27,7 @@ import java.util.ArrayList; @@ -27,7 +27,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.annotation.MergedAnnotations.SearchStrategy;
import org.springframework.util.ReflectionUtils;

2
spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationsRepeatableAnnotationTests.java

@ -27,7 +27,7 @@ import java.lang.reflect.AnnotatedElement; @@ -27,7 +27,7 @@ import java.lang.reflect.AnnotatedElement;
import java.util.Set;
import org.assertj.core.api.ThrowableTypeAssert;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.annotation.MergedAnnotations.SearchStrategy;

2
spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationsTests.java

@ -36,7 +36,7 @@ import java.util.stream.Collectors; @@ -36,7 +36,7 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.Resource;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.MergedAnnotation.Adapt;

2
spring-core/src/test/java/org/springframework/core/annotation/MissingMergedAnnotationTests.java

@ -23,7 +23,7 @@ import java.util.Map; @@ -23,7 +23,7 @@ import java.util.Map;
import java.util.NoSuchElementException;
import org.assertj.core.api.ThrowableTypeAssert;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.util.ConcurrentReferenceHashMap;

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

@ -26,8 +26,8 @@ import java.lang.reflect.Method; @@ -26,8 +26,8 @@ import java.lang.reflect.Method;
import java.util.Iterator;
import java.util.Set;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.core.annotation.AnnotatedElementUtils.findAllMergedAnnotations;
@ -105,7 +105,7 @@ public class MultipleComposedAnnotationsOnSingleAnnotatedElementTests { @@ -105,7 +105,7 @@ public class MultipleComposedAnnotationsOnSingleAnnotatedElementTests {
}
@Test
@Ignore("Disabled since some Java 8 updates handle the bridge method differently")
@Disabled("Disabled since some Java 8 updates handle the bridge method differently")
public void getMultipleComposedAnnotationsOnBridgeMethod() throws Exception {
Set<Cacheable> cacheables = getAllMergedAnnotations(getBridgeMethod(), Cacheable.class);
assertThat(cacheables).isNotNull();

2
spring-core/src/test/java/org/springframework/core/annotation/OrderSourceProviderTests.java

@ -21,7 +21,7 @@ import java.util.Arrays; @@ -21,7 +21,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.Ordered;

2
spring-core/src/test/java/org/springframework/core/annotation/OrderUtilsTests.java

@ -18,7 +18,7 @@ package org.springframework.core.annotation; @@ -18,7 +18,7 @@ package org.springframework.core.annotation;
import javax.annotation.Priority;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

2
spring-core/src/test/java/org/springframework/core/annotation/PackagesAnnotationFilterTests.java

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
package org.springframework.core.annotation;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;

2
spring-core/src/test/java/org/springframework/core/annotation/RepeatableContainersTests.java

@ -21,7 +21,7 @@ import java.lang.annotation.Repeatable; @@ -21,7 +21,7 @@ import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

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

@ -18,8 +18,8 @@ package org.springframework.core.annotation; @@ -18,8 +18,8 @@ package org.springframework.core.annotation;
import java.lang.reflect.Method;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.MethodParameter;
@ -41,7 +41,7 @@ public class SynthesizingMethodParameterTests { @@ -41,7 +41,7 @@ public class SynthesizingMethodParameterTests {
private SynthesizingMethodParameter intReturnType;
@Before
@BeforeEach
public void setUp() throws NoSuchMethodException {
method = getClass().getMethod("method", String.class, Long.TYPE);
stringParameter = new SynthesizingMethodParameter(method, 0);

2
spring-core/src/test/java/org/springframework/core/annotation/TypeMappedAnnotationTests.java

@ -24,7 +24,7 @@ import java.util.Collections; @@ -24,7 +24,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

2
spring-core/src/test/java/org/springframework/core/codec/AbstractDecoderTestCase.java

@ -20,7 +20,7 @@ import java.time.Duration; @@ -20,7 +20,7 @@ import java.time.Duration;
import java.util.Map;
import java.util.function.Consumer;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

2
spring-core/src/test/java/org/springframework/core/codec/AbstractEncoderTestCase.java

@ -19,7 +19,7 @@ package org.springframework.core.codec; @@ -19,7 +19,7 @@ package org.springframework.core.codec;
import java.util.Map;
import java.util.function.Consumer;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;
import reactor.test.StepVerifier;

2
spring-core/src/test/java/org/springframework/core/codec/ByteArrayDecoderTests.java

@ -19,7 +19,7 @@ package org.springframework.core.codec; @@ -19,7 +19,7 @@ package org.springframework.core.codec;
import java.nio.charset.StandardCharsets;
import java.util.function.Consumer;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import org.springframework.core.ResolvableType;

2
spring-core/src/test/java/org/springframework/core/codec/ByteArrayEncoderTests.java

@ -18,7 +18,7 @@ package org.springframework.core.codec; @@ -18,7 +18,7 @@ package org.springframework.core.codec;
import java.nio.charset.StandardCharsets;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import org.springframework.core.ResolvableType;

2
spring-core/src/test/java/org/springframework/core/codec/ByteBufferDecoderTests.java

@ -20,7 +20,7 @@ import java.nio.ByteBuffer; @@ -20,7 +20,7 @@ import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.function.Consumer;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import org.springframework.core.ResolvableType;

2
spring-core/src/test/java/org/springframework/core/codec/ByteBufferEncoderTests.java

@ -19,7 +19,7 @@ package org.springframework.core.codec; @@ -19,7 +19,7 @@ package org.springframework.core.codec;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import org.springframework.core.ResolvableType;

2
spring-core/src/test/java/org/springframework/core/codec/CharSequenceEncoderTests.java

@ -19,7 +19,7 @@ package org.springframework.core.codec; @@ -19,7 +19,7 @@ package org.springframework.core.codec;
import java.nio.charset.Charset;
import java.util.stream.Stream;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import org.springframework.core.ResolvableType;

2
spring-core/src/test/java/org/springframework/core/codec/DataBufferDecoderTests.java

@ -19,7 +19,7 @@ package org.springframework.core.codec; @@ -19,7 +19,7 @@ package org.springframework.core.codec;
import java.nio.charset.StandardCharsets;
import java.util.function.Consumer;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import org.springframework.core.ResolvableType;

2
spring-core/src/test/java/org/springframework/core/codec/DataBufferEncoderTests.java

@ -18,7 +18,7 @@ package org.springframework.core.codec; @@ -18,7 +18,7 @@ package org.springframework.core.codec;
import java.nio.charset.StandardCharsets;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

2
spring-core/src/test/java/org/springframework/core/codec/ResourceDecoderTests.java

@ -20,7 +20,7 @@ import java.io.IOException; @@ -20,7 +20,7 @@ import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import org.springframework.core.ResolvableType;

2
spring-core/src/test/java/org/springframework/core/codec/ResourceEncoderTests.java

@ -18,7 +18,7 @@ package org.springframework.core.codec; @@ -18,7 +18,7 @@ package org.springframework.core.codec;
import java.util.Map;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;
import reactor.test.StepVerifier;

6
spring-core/src/test/java/org/springframework/core/codec/ResourceRegionEncoderTests.java

@ -19,8 +19,8 @@ package org.springframework.core.codec; @@ -19,8 +19,8 @@ package org.springframework.core.codec;
import java.util.Collections;
import java.util.function.Consumer;
import org.junit.After;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.reactivestreams.Subscription;
import reactor.core.publisher.BaseSubscriber;
import reactor.core.publisher.Flux;
@ -52,7 +52,7 @@ public class ResourceRegionEncoderTests { @@ -52,7 +52,7 @@ public class ResourceRegionEncoderTests {
private LeakAwareDataBufferFactory bufferFactory = new LeakAwareDataBufferFactory();
@After
@AfterEach
public void tearDown() throws Exception {
this.bufferFactory.checkForLeaks();
}

2
spring-core/src/test/java/org/springframework/core/codec/StringDecoderTests.java

@ -23,7 +23,7 @@ import java.util.Arrays; @@ -23,7 +23,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import reactor.test.StepVerifier;

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

@ -36,7 +36,7 @@ import java.util.List; @@ -36,7 +36,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.MethodParameter;
import org.springframework.util.LinkedMultiValueMap;

2
spring-core/src/test/java/org/springframework/core/convert/converter/ConvertingComparatorTests.java

@ -23,7 +23,7 @@ import java.util.LinkedHashMap; @@ -23,7 +23,7 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.support.DefaultConversionService;

2
spring-core/src/test/java/org/springframework/core/convert/converter/DefaultConversionServiceTests.java

@ -44,7 +44,7 @@ import java.util.TimeZone; @@ -44,7 +44,7 @@ import java.util.TimeZone;
import java.util.UUID;
import java.util.stream.Stream;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.MethodParameter;
import org.springframework.core.convert.ConversionFailedException;

6
spring-core/src/test/java/org/springframework/core/convert/support/ByteBufferConverterTests.java

@ -18,8 +18,8 @@ package org.springframework.core.convert.support; @@ -18,8 +18,8 @@ package org.springframework.core.convert.support;
import java.nio.ByteBuffer;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.convert.converter.Converter;
@ -40,7 +40,7 @@ public class ByteBufferConverterTests { @@ -40,7 +40,7 @@ public class ByteBufferConverterTests {
private GenericConversionService conversionService;
@Before
@BeforeEach
public void setup() {
this.conversionService = new DefaultConversionService();
this.conversionService.addConverter(new ByteArrayToOtherTypeConverter());

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

@ -30,8 +30,8 @@ import java.util.LinkedList; @@ -30,8 +30,8 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Vector;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.convert.ConversionFailedException;
import org.springframework.core.convert.ConverterNotFoundException;
@ -53,7 +53,7 @@ public class CollectionToCollectionConverterTests { @@ -53,7 +53,7 @@ public class CollectionToCollectionConverterTests {
private GenericConversionService conversionService = new GenericConversionService();
@Before
@BeforeEach
public void setUp() {
conversionService.addConverter(new CollectionToCollectionConverter(conversionService));
}

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

@ -32,7 +32,7 @@ import java.util.List; @@ -32,7 +32,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.convert.ConversionFailedException;
import org.springframework.core.convert.ConverterNotFoundException;

6
spring-core/src/test/java/org/springframework/core/convert/support/MapToMapConverterTests.java

@ -24,8 +24,8 @@ import java.util.LinkedHashMap; @@ -24,8 +24,8 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.convert.ConversionFailedException;
import org.springframework.core.convert.ConverterNotFoundException;
@ -46,7 +46,7 @@ public class MapToMapConverterTests { @@ -46,7 +46,7 @@ public class MapToMapConverterTests {
private final GenericConversionService conversionService = new GenericConversionService();
@Before
@BeforeEach
public void setUp() {
conversionService.addConverter(new MapToMapConverter(conversionService));
}

6
spring-core/src/test/java/org/springframework/core/convert/support/StreamConverterTests.java

@ -20,8 +20,8 @@ import java.util.Arrays; @@ -20,8 +20,8 @@ import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.convert.ConversionFailedException;
import org.springframework.core.convert.ConverterNotFoundException;
@ -45,7 +45,7 @@ public class StreamConverterTests { @@ -45,7 +45,7 @@ public class StreamConverterTests {
private final StreamConverter streamConverter = new StreamConverter(this.conversionService);
@Before
@BeforeEach
public void setup() {
this.conversionService.addConverter(new CollectionToCollectionConverter(this.conversionService));
this.conversionService.addConverter(new ArrayToCollectionConverter(this.conversionService));

2
spring-core/src/test/java/org/springframework/core/env/CompositePropertySourceTests.java vendored

@ -18,7 +18,7 @@ package org.springframework.core.env; @@ -18,7 +18,7 @@ package org.springframework.core.env;
import java.util.Collections;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

2
spring-core/src/test/java/org/springframework/core/env/CustomEnvironmentTests.java vendored

@ -20,7 +20,7 @@ import java.util.Collections; @@ -20,7 +20,7 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

2
spring-core/src/test/java/org/springframework/core/env/JOptCommandLinePropertySourceTests.java vendored

@ -20,7 +20,7 @@ import java.util.Arrays; @@ -20,7 +20,7 @@ import java.util.Arrays;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

2
spring-core/src/test/java/org/springframework/core/env/MutablePropertySourcesTests.java vendored

@ -18,7 +18,7 @@ package org.springframework.core.env; @@ -18,7 +18,7 @@ package org.springframework.core.env;
import java.util.Iterator;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.mock.env.MockPropertySource;

2
spring-core/src/test/java/org/springframework/core/env/ProfilesTests.java vendored

@ -21,7 +21,7 @@ import java.util.List; @@ -21,7 +21,7 @@ import java.util.List;
import java.util.function.Predicate;
import java.util.function.Supplier;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.util.StringUtils;

2
spring-core/src/test/java/org/springframework/core/env/PropertySourceTests.java vendored

@ -22,7 +22,7 @@ import java.util.List; @@ -22,7 +22,7 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

6
spring-core/src/test/java/org/springframework/core/env/PropertySourcesPropertyResolverTests.java vendored

@ -20,8 +20,8 @@ import java.util.HashMap; @@ -20,8 +20,8 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.convert.ConverterNotFoundException;
import org.springframework.mock.env.MockPropertySource;
@ -44,7 +44,7 @@ public class PropertySourcesPropertyResolverTests { @@ -44,7 +44,7 @@ public class PropertySourcesPropertyResolverTests {
private ConfigurablePropertyResolver propertyResolver;
@Before
@BeforeEach
public void setUp() {
propertySources = new MutablePropertySources();
propertyResolver = new PropertySourcesPropertyResolver(propertySources);

2
spring-core/src/test/java/org/springframework/core/env/SimpleCommandLineParserTests.java vendored

@ -19,7 +19,7 @@ package org.springframework.core.env; @@ -19,7 +19,7 @@ package org.springframework.core.env;
import java.util.Collections;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

2
spring-core/src/test/java/org/springframework/core/env/SimpleCommandLinePropertySourceTests.java vendored

@ -18,7 +18,7 @@ package org.springframework.core.env; @@ -18,7 +18,7 @@ package org.springframework.core.env;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

2
spring-core/src/test/java/org/springframework/core/env/StandardEnvironmentTests.java vendored

@ -23,7 +23,7 @@ import java.util.Arrays; @@ -23,7 +23,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Map;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.SpringProperties;
import org.springframework.mock.env.MockPropertySource;

6
spring-core/src/test/java/org/springframework/core/env/SystemEnvironmentPropertySourceTests.java vendored

@ -21,8 +21,8 @@ import java.util.HashSet; @@ -21,8 +21,8 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
@ -41,7 +41,7 @@ public class SystemEnvironmentPropertySourceTests { @@ -41,7 +41,7 @@ public class SystemEnvironmentPropertySourceTests {
private PropertySource<?> ps;
@Before
@BeforeEach
public void setUp() {
envMap = new HashMap<>();
ps = new SystemEnvironmentPropertySource("sysEnv", envMap);

2
spring-core/src/test/java/org/springframework/core/io/ClassPathResourceTests.java

@ -20,7 +20,7 @@ import java.io.FileNotFoundException; @@ -20,7 +20,7 @@ import java.io.FileNotFoundException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

24
spring-core/src/test/java/org/springframework/core/io/PathResourceTests.java

@ -25,12 +25,12 @@ import java.nio.channels.ReadableByteChannel; @@ -25,12 +25,12 @@ import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritableByteChannel;
import java.nio.charset.StandardCharsets;
import java.nio.file.AccessDeniedException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import org.springframework.util.FileCopyUtils;
@ -68,10 +68,6 @@ public class PathResourceTests { @@ -68,10 +68,6 @@ public class PathResourceTests {
}
@Rule
public TemporaryFolder temporaryFolder = new TemporaryFolder();
@Test
public void nullPath() {
assertThatIllegalArgumentException().isThrownBy(() ->
@ -270,15 +266,15 @@ public class PathResourceTests { @@ -270,15 +266,15 @@ public class PathResourceTests {
}
@Test
public void outputStream() throws IOException {
PathResource resource = new PathResource(temporaryFolder.newFile("test").toPath());
public void outputStream(@TempDir Path temporaryFolder) throws IOException {
PathResource resource = new PathResource(temporaryFolder.resolve("test"));
FileCopyUtils.copy("test".getBytes(StandardCharsets.UTF_8), resource.getOutputStream());
assertThat(resource.contentLength()).isEqualTo(4L);
}
@Test
public void doesNotExistOutputStream() throws IOException {
File file = temporaryFolder.newFile("test");
public void doesNotExistOutputStream(@TempDir Path temporaryFolder) throws IOException {
File file = temporaryFolder.resolve("test").toFile();
file.delete();
PathResource resource = new PathResource(file.toPath());
FileCopyUtils.copy("test".getBytes(), resource.getOutputStream());
@ -329,8 +325,10 @@ public class PathResourceTests { @@ -329,8 +325,10 @@ public class PathResourceTests {
}
@Test
public void getWritableChannel() throws IOException {
PathResource resource = new PathResource(temporaryFolder.newFile("test").toPath());
public void getWritableChannel(@TempDir Path temporaryFolder) throws IOException {
Path testPath = temporaryFolder.resolve("test");
Files.createFile(testPath);
PathResource resource = new PathResource(testPath);
ByteBuffer buffer = ByteBuffer.wrap("test".getBytes(StandardCharsets.UTF_8));
WritableByteChannel channel = null;
try {

2
spring-core/src/test/java/org/springframework/core/io/ResourceEditorTests.java

@ -18,7 +18,7 @@ package org.springframework.core.io; @@ -18,7 +18,7 @@ package org.springframework.core.io;
import java.beans.PropertyEditor;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.env.StandardEnvironment;

2
spring-core/src/test/java/org/springframework/core/io/ResourceTests.java

@ -28,7 +28,7 @@ import java.nio.file.Paths; @@ -28,7 +28,7 @@ import java.nio.file.Paths;
import java.util.HashSet;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.util.FileCopyUtils;

4
spring-core/src/test/java/org/springframework/core/io/buffer/AbstractLeakCheckingTestCase.java

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
package org.springframework.core.io.buffer;
import org.junit.After;
import org.junit.jupiter.api.AfterEach;
/**
* Abstract base class for unit tests that allocate data buffers via a {@link DataBufferFactory}.
@ -39,7 +39,7 @@ public abstract class AbstractLeakCheckingTestCase { @@ -39,7 +39,7 @@ public abstract class AbstractLeakCheckingTestCase {
* Checks whether any of the data buffers created by {@link #bufferFactory} have not been
* released, throwing an assertion error if so.
*/
@After
@AfterEach
public final void checkForLeaks() {
this.bufferFactory.checkForLeaks();
}

12
spring-core/src/test/java/org/springframework/core/io/buffer/LeakAwareDataBufferFactory.java

@ -27,16 +27,16 @@ import io.netty.buffer.PooledByteBufAllocator; @@ -27,16 +27,16 @@ import io.netty.buffer.PooledByteBufAllocator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jetbrains.annotations.NotNull;
import org.junit.After;
import org.springframework.util.Assert;
/**
* Implementation of the {@code DataBufferFactory} interface that keep track of memory leaks.
* Useful for unit tests that handle data buffers. Simply inherit from
* Implementation of the {@code DataBufferFactory} interface that keeps track of
* memory leaks.
* <p>Useful for unit tests that handle data buffers. Simply inherit from
* {@link AbstractLeakCheckingTestCase} or call {@link #checkForLeaks()} in
* a JUnit {@link After} method yourself, and any buffers have not been released will result in an
* {@link AssertionError}.
* a JUnit <em>after</em> method yourself, and any buffers that have not been
* released will result in an {@link AssertionError}.
*
* @author Arjen Poutsma
* @see LeakAwareDataBufferFactory
@ -71,7 +71,7 @@ public class LeakAwareDataBufferFactory implements DataBufferFactory { @@ -71,7 +71,7 @@ public class LeakAwareDataBufferFactory implements DataBufferFactory {
/**
* Checks whether all of the data buffers allocated by this factory have also been released.
* If not, then an {@link AssertionError} is thrown. Typically used from a JUnit {@link After}
* If not, then an {@link AssertionError} is thrown. Typically used from a JUnit <em>after</em>
* method.
*/
public void checkForLeaks() {

2
spring-core/src/test/java/org/springframework/core/io/buffer/LeakAwareDataBufferFactoryTests.java

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
package org.springframework.core.io.buffer;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.springframework.core.io.buffer.DataBufferUtils.release;

2
spring-core/src/test/java/org/springframework/core/io/support/EncodedResourceTests.java

@ -18,7 +18,7 @@ package org.springframework.core.io.support; @@ -18,7 +18,7 @@ package org.springframework.core.io.support;
import java.nio.charset.Charset;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.io.DescriptiveResource;
import org.springframework.core.io.Resource;

6
spring-core/src/test/java/org/springframework/core/io/support/PathMatchingResourcePatternResolverTests.java

@ -22,8 +22,8 @@ import java.util.ArrayList; @@ -22,8 +22,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.core.io.Resource;
import org.springframework.util.StringUtils;
@ -79,7 +79,7 @@ public class PathMatchingResourcePatternResolverTests { @@ -79,7 +79,7 @@ public class PathMatchingResourcePatternResolverTests {
assertProtocolAndFilenames(resources, "jar", "Publisher.class");
}
@Ignore // passes under Eclipse, fails under Ant
@Disabled
@Test
public void classpathStarWithPatternOnFileSystem() throws IOException {
Resource[] resources = resolver.getResources("classpath*:org/springframework/core/io/sup*/*.class");

2
spring-core/src/test/java/org/springframework/core/io/support/ResourceArrayPropertyEditorTests.java

@ -18,7 +18,7 @@ package org.springframework.core.io.support; @@ -18,7 +18,7 @@ package org.springframework.core.io.support;
import java.beans.PropertyEditor;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.env.StandardEnvironment;
import org.springframework.core.io.Resource;

2
spring-core/src/test/java/org/springframework/core/io/support/ResourcePropertySourceTests.java

@ -18,7 +18,7 @@ package org.springframework.core.io.support; @@ -18,7 +18,7 @@ package org.springframework.core.io.support;
import java.io.IOException;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.env.PropertySource;
import org.springframework.core.io.ByteArrayResource;

2
spring-core/src/test/java/org/springframework/core/io/support/ResourceRegionTests.java

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
package org.springframework.core.io.support;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.io.Resource;

2
spring-core/src/test/java/org/springframework/core/io/support/SpringFactoriesLoaderTests.java

@ -19,7 +19,7 @@ package org.springframework.core.io.support; @@ -19,7 +19,7 @@ package org.springframework.core.io.support;
import java.lang.reflect.Modifier;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;

2
spring-core/src/test/java/org/springframework/core/log/LogSupportTests.java

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
package org.springframework.core.log;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

2
spring-core/src/test/java/org/springframework/core/serializer/SerializationConverterTests.java

@ -19,7 +19,7 @@ package org.springframework.core.serializer; @@ -19,7 +19,7 @@ package org.springframework.core.serializer;
import java.io.NotSerializableException;
import java.io.Serializable;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.serializer.support.DeserializingConverter;
import org.springframework.core.serializer.support.SerializationFailedException;

2
spring-core/src/test/java/org/springframework/core/style/DefaultValueStylerTests.java

@ -24,7 +24,7 @@ import java.util.LinkedHashMap; @@ -24,7 +24,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

6
spring-core/src/test/java/org/springframework/core/style/ToStringCreatorTests.java

@ -23,8 +23,8 @@ import java.util.List; @@ -23,8 +23,8 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.util.ObjectUtils;
@ -38,7 +38,7 @@ public class ToStringCreatorTests { @@ -38,7 +38,7 @@ public class ToStringCreatorTests {
private SomeObject s1, s2, s3;
@Before
@BeforeEach
public void setUp() throws Exception {
s1 = new SomeObject() {
@Override

2
spring-core/src/test/java/org/springframework/core/task/SimpleAsyncTaskExecutorTests.java

@ -18,7 +18,7 @@ package org.springframework.core.task; @@ -18,7 +18,7 @@ package org.springframework.core.task;
import java.util.concurrent.ThreadFactory;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.util.ConcurrencyThrottleSupport;

2
spring-core/src/test/java/org/springframework/core/type/AbstractAnnotationMetadataTests.java

@ -19,7 +19,7 @@ package org.springframework.core.type; @@ -19,7 +19,7 @@ package org.springframework.core.type;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.annotation.MergedAnnotation;
import org.springframework.core.type.AbstractAnnotationMetadataTests.TestMemberClass.TestMemberClassInnerClass;

2
spring-core/src/test/java/org/springframework/core/type/AbstractClassMetadataMemberClassTests.java

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
package org.springframework.core.type;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

2
spring-core/src/test/java/org/springframework/core/type/AbstractMethodMetadataTests.java

@ -19,7 +19,7 @@ package org.springframework.core.type; @@ -19,7 +19,7 @@ package org.springframework.core.type;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.annotation.MergedAnnotation;
import org.springframework.util.MultiValueMap;

2
spring-core/src/test/java/org/springframework/core/type/AnnotationMetadataTests.java

@ -29,7 +29,7 @@ import java.util.HashSet; @@ -29,7 +29,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.core.annotation.AliasFor;
import org.springframework.core.annotation.AnnotationAttributes;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save