Migrate rest of test suite from JUnit 4 to JUnit Jupiter
This commit migrates the rest of Spring's test suite to JUnit Jupiter, except spring-test which will be migrated in a separate commit. See gh-23451
This commit is contained in:
@@ -23,7 +23,7 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.util.SerializationTestUtils;
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
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.messaging.MessageHeaders;
|
||||
import org.springframework.util.InvalidMimeTypeException;
|
||||
@@ -41,7 +41,7 @@ public class DefaultContentTypeResolverTests {
|
||||
private DefaultContentTypeResolver resolver;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.resolver = new DefaultContentTypeResolver();
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.messaging.converter;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.convert.ConversionException;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.Map;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.messaging.Message;
|
||||
|
||||
@@ -20,8 +20,8 @@ import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.xmlunit.diff.DifferenceEvaluator;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
@@ -44,7 +44,7 @@ public class MarshallingMessageConverterTests {
|
||||
private MarshallingMessageConverter converter;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void createMarshaller() throws Exception {
|
||||
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
|
||||
marshaller.setClassesToBeBound(MyBean.class);
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.messaging.Message;
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.messaging.converter;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHeaders;
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHeaders;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.messaging.core;
|
||||
|
||||
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;
|
||||
|
||||
@@ -20,8 +20,8 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
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.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
@@ -47,7 +47,7 @@ public class DestinationResolvingMessagingTemplateTests {
|
||||
private TestMessagePostProcessor postProcessor;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
|
||||
TestMessageChannelDestinationResolver resolver = new TestMessageChannelDestinationResolver();
|
||||
|
||||
@@ -21,8 +21,8 @@ import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
@@ -61,7 +61,7 @@ public class GenericMessagingTemplateTests {
|
||||
private ThreadPoolTaskExecutor executor;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.messageChannel = new StubMessageChannel();
|
||||
this.template = new GenericMessagingTemplate();
|
||||
|
||||
@@ -18,8 +18,8 @@ package org.springframework.messaging.core;
|
||||
|
||||
import java.io.Writer;
|
||||
|
||||
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.messaging.Message;
|
||||
@@ -42,7 +42,7 @@ public class MessageReceivingTemplateTests {
|
||||
private TestMessagingTemplate template;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.template = new TestMessagingTemplate();
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ package org.springframework.messaging.core;
|
||||
import java.util.Collections;
|
||||
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.messaging.Message;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
@@ -44,7 +44,7 @@ public class MessageRequestReplyTemplateTests {
|
||||
private Map<String, Object> headers;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.template = new TestMessagingTemplate();
|
||||
this.postProcessor = new TestMessagePostProcessor();
|
||||
|
||||
@@ -21,8 +21,8 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
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.messaging.Message;
|
||||
import org.springframework.messaging.MessageHeaders;
|
||||
@@ -54,7 +54,7 @@ public class MessageSendingTemplateTests {
|
||||
private Map<String, Object> headers;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.template = new TestMessageSendingTemplate();
|
||||
this.postProcessor = new TestMessagePostProcessor();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.messaging.handler;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.support.MessageBuilder;
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.time.Duration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
|
||||
@@ -21,8 +21,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.context.support.GenericApplicationContext;
|
||||
import org.springframework.core.MethodParameter;
|
||||
@@ -50,7 +50,7 @@ public class HeaderMethodArgumentResolverTests {
|
||||
private final ResolvableMethod resolvable = ResolvableMethod.on(getClass()).named("handleMessage").build();
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
GenericApplicationContext context = new GenericApplicationContext();
|
||||
context.refresh();
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.time.Duration;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.messaging.Message;
|
||||
|
||||
@@ -20,7 +20,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.core.publisher.Mono;
|
||||
import reactor.test.StepVerifier;
|
||||
|
||||
@@ -22,7 +22,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.reactivestreams.Publisher;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.io.IOException;
|
||||
import java.net.BindException;
|
||||
import java.net.SocketException;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.messaging.handler.annotation.MessageExceptionHandler;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
@@ -24,9 +24,7 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TestName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.support.StaticListableBeanFactory;
|
||||
import org.springframework.core.MethodParameter;
|
||||
@@ -56,9 +54,6 @@ public class DefaultMessageHandlerMethodFactoryTests {
|
||||
|
||||
private final SampleBean sample = new SampleBean();
|
||||
|
||||
@Rule
|
||||
public final TestName name = new TestName();
|
||||
|
||||
|
||||
@Test
|
||||
public void customConversion() throws Exception {
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.messaging.handler.annotation.support;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
|
||||
@@ -20,8 +20,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.context.support.GenericApplicationContext;
|
||||
import org.springframework.core.MethodParameter;
|
||||
@@ -52,7 +52,7 @@ public class HeaderMethodArgumentResolverTests {
|
||||
private final ResolvableMethod resolvable = ResolvableMethod.on(getClass()).named("handleMessage").build();
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
GenericApplicationContext context = new GenericApplicationContext();
|
||||
context.refresh();
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.messaging.handler.annotation.support;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.messaging.Message;
|
||||
|
||||
@@ -19,8 +19,8 @@ package org.springframework.messaging.handler.annotation.support;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Locale;
|
||||
|
||||
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;
|
||||
import org.springframework.messaging.Message;
|
||||
@@ -51,7 +51,7 @@ public class MessageMethodArgumentResolverTests {
|
||||
private Method method;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() throws Exception {
|
||||
this.method = MessageMethodArgumentResolverTests.class.getDeclaredMethod("handle",
|
||||
Message.class, Message.class, Message.class, Message.class, ErrorMessage.class, Message.class);
|
||||
|
||||
@@ -23,8 +23,8 @@ import java.lang.annotation.Target;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
|
||||
import org.springframework.core.MethodParameter;
|
||||
@@ -68,7 +68,7 @@ public class PayloadMethodArgumentResolverTests {
|
||||
private MethodParameter paramValidated;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() throws Exception {
|
||||
this.resolver = new PayloadMethodArgumentResolver(new StringMessageConverter(), testValidator());
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.messaging.handler.invocation;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
@@ -26,8 +26,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.context.support.StaticApplicationContext;
|
||||
import org.springframework.messaging.Message;
|
||||
@@ -59,7 +59,7 @@ public class MethodMessageHandlerTests {
|
||||
private TestController testController;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
|
||||
List<String> destinationPrefixes = Arrays.asList("/test");
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.messaging.handler.invocation.reactive;
|
||||
import java.util.Collections;
|
||||
|
||||
import io.reactivex.Completable;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.test.StepVerifier;
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.test.StepVerifier;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.reactivestreams.Publisher;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.test.StepVerifier;
|
||||
|
||||
@@ -21,9 +21,9 @@ import java.util.Map;
|
||||
|
||||
import io.netty.buffer.PooledByteBufAllocator;
|
||||
import io.rsocket.Payload;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.codec.ByteArrayDecoder;
|
||||
import org.springframework.core.codec.StringDecoder;
|
||||
@@ -52,14 +52,14 @@ public class DefaultMetadataExtractorTests {
|
||||
private DefaultMetadataExtractor extractor;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
DataBufferFactory bufferFactory = new LeakAwareNettyDataBufferFactory(PooledByteBufAllocator.DEFAULT);
|
||||
this.strategies = RSocketStrategies.builder().dataBufferFactory(bufferFactory).build();
|
||||
this.extractor = new DefaultMetadataExtractor(StringDecoder.allMimeTypes());
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void tearDown() throws InterruptedException {
|
||||
DataBufferFactory bufferFactory = this.strategies.dataBufferFactory();
|
||||
((LeakAwareNettyDataBufferFactory) bufferFactory).checkForLeaks(Duration.ofSeconds(5));
|
||||
|
||||
@@ -29,8 +29,8 @@ import io.rsocket.DuplexConnection;
|
||||
import io.rsocket.RSocketFactory;
|
||||
import io.rsocket.frame.decoder.PayloadDecoder;
|
||||
import io.rsocket.transport.ClientTransport;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.reactivestreams.Publisher;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
@@ -68,7 +68,7 @@ public class DefaultRSocketRequesterBuilderTests {
|
||||
private final TestRSocketFactoryConfigurer rsocketFactoryConfigurer = new TestRSocketFactoryConfigurer();
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.transport = mock(ClientTransport.class);
|
||||
given(this.transport.connect(anyInt())).willReturn(Mono.just(this.connection));
|
||||
|
||||
@@ -28,8 +28,8 @@ import io.reactivex.Observable;
|
||||
import io.reactivex.Single;
|
||||
import io.rsocket.AbstractRSocket;
|
||||
import io.rsocket.Payload;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.reactivestreams.Publisher;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
@@ -64,7 +64,7 @@ public class DefaultRSocketRequesterTests {
|
||||
private final DefaultDataBufferFactory bufferFactory = new DefaultDataBufferFactory();
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
this.rsocket = new TestRSocket();
|
||||
this.requester = RSocketRequester.wrap(this.rsocket, TEXT_PLAIN, TEXT_PLAIN, this.strategies);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.springframework.messaging.rsocket;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.ReactiveAdapterRegistry;
|
||||
import org.springframework.core.codec.ByteArrayDecoder;
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.Map;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.ByteBufAllocator;
|
||||
import io.rsocket.metadata.CompositeMetadata;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.io.buffer.DataBuffer;
|
||||
import org.springframework.core.io.buffer.DefaultDataBufferFactory;
|
||||
|
||||
@@ -22,8 +22,8 @@ import io.netty.buffer.PooledByteBufAllocator;
|
||||
import io.rsocket.Payload;
|
||||
import io.rsocket.util.ByteBufPayload;
|
||||
import io.rsocket.util.DefaultPayload;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.io.buffer.DataBuffer;
|
||||
import org.springframework.core.io.buffer.DataBufferUtils;
|
||||
@@ -47,7 +47,7 @@ public class PayloadUtilsTests {
|
||||
private DefaultDataBufferFactory defaultBufferFactory = new DefaultDataBufferFactory();
|
||||
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void tearDown() throws Exception {
|
||||
this.nettyBufferFactory.checkForLeaks(Duration.ofSeconds(5));
|
||||
}
|
||||
|
||||
@@ -31,11 +31,11 @@ import io.rsocket.frame.decoder.PayloadDecoder;
|
||||
import io.rsocket.plugins.RSocketInterceptor;
|
||||
import io.rsocket.transport.netty.server.CloseableChannel;
|
||||
import io.rsocket.transport.netty.server.TcpServerTransport;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.reactivestreams.Publisher;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
@@ -70,7 +70,7 @@ public class RSocketBufferLeakTests {
|
||||
private static RSocketRequester requester;
|
||||
|
||||
|
||||
@BeforeClass
|
||||
@BeforeAll
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
public static void setupOnce() {
|
||||
|
||||
@@ -93,20 +93,20 @@ public class RSocketBufferLeakTests {
|
||||
.block();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@AfterAll
|
||||
public static void tearDownOnce() {
|
||||
requester.rsocket().dispose();
|
||||
server.dispose();
|
||||
}
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
getLeakAwareNettyDataBufferFactory().reset();
|
||||
payloadInterceptor.reset();
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void tearDown() throws InterruptedException {
|
||||
getLeakAwareNettyDataBufferFactory().checkForLeaks(Duration.ofSeconds(5));
|
||||
payloadInterceptor.checkForLeaks();
|
||||
|
||||
@@ -23,9 +23,9 @@ import io.rsocket.SocketAcceptor;
|
||||
import io.rsocket.frame.decoder.PayloadDecoder;
|
||||
import io.rsocket.transport.netty.server.CloseableChannel;
|
||||
import io.rsocket.transport.netty.server.TcpServerTransport;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.core.publisher.ReplayProcessor;
|
||||
@@ -57,7 +57,7 @@ public class RSocketClientToServerIntegrationTests {
|
||||
private static RSocketRequester requester;
|
||||
|
||||
|
||||
@BeforeClass
|
||||
@BeforeAll
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
public static void setupOnce() {
|
||||
|
||||
@@ -79,7 +79,7 @@ public class RSocketClientToServerIntegrationTests {
|
||||
.block();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@AfterAll
|
||||
public static void tearDownOnce() {
|
||||
requester.rsocket().dispose();
|
||||
server.dispose();
|
||||
|
||||
@@ -23,9 +23,9 @@ import io.rsocket.SocketAcceptor;
|
||||
import io.rsocket.frame.decoder.PayloadDecoder;
|
||||
import io.rsocket.transport.netty.server.CloseableChannel;
|
||||
import io.rsocket.transport.netty.server.TcpServerTransport;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.core.publisher.MonoProcessor;
|
||||
@@ -54,7 +54,7 @@ public class RSocketServerToClientIntegrationTests {
|
||||
private static CloseableChannel server;
|
||||
|
||||
|
||||
@BeforeClass
|
||||
@BeforeAll
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
public static void setupOnce() {
|
||||
|
||||
@@ -70,7 +70,7 @@ public class RSocketServerToClientIntegrationTests {
|
||||
.block();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@AfterAll
|
||||
public static void tearDownOnce() {
|
||||
server.dispose();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.messaging.rsocket.annotation.support;
|
||||
import java.util.Arrays;
|
||||
|
||||
import io.rsocket.frame.FrameType;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.messaging.Message;
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import io.rsocket.frame.FrameType;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.ReactiveAdapterRegistry;
|
||||
import org.springframework.core.codec.ByteArrayDecoder;
|
||||
|
||||
@@ -19,9 +19,9 @@ package org.springframework.messaging.simp;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
@@ -47,13 +47,13 @@ public class SimpAttributesContextHolderTests {
|
||||
private SimpAttributes simpAttributes;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
Map<String, Object> map = new ConcurrentHashMap<>();
|
||||
this.simpAttributes = new SimpAttributes("session1", map);
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void tearDown() {
|
||||
SimpAttributesContextHolder.resetAttributes();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.messaging.simp;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
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;
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.security.Principal;
|
||||
import java.util.Collections;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.messaging.simp;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.support.MessageBuilder;
|
||||
|
||||
@@ -22,8 +22,8 @@ import java.util.HashMap;
|
||||
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.messaging.Message;
|
||||
import org.springframework.messaging.MessageHeaders;
|
||||
@@ -49,7 +49,7 @@ public class SimpMessagingTemplateTests {
|
||||
private StubMessageChannel messageChannel;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.messageChannel = new StubMessageChannel();
|
||||
this.messagingTemplate = new SimpMessagingTemplate(this.messageChannel);
|
||||
|
||||
@@ -18,9 +18,9 @@ package org.springframework.messaging.simp;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import org.springframework.beans.factory.ObjectFactory;
|
||||
@@ -46,7 +46,7 @@ public class SimpSessionScopeTests {
|
||||
private SimpAttributes simpAttributes;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
this.scope = new SimpSessionScope();
|
||||
this.objectFactory = Mockito.mock(ObjectFactory.class);
|
||||
@@ -54,7 +54,7 @@ public class SimpSessionScopeTests {
|
||||
SimpAttributesContextHolder.setAttributes(this.simpAttributes);
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void tearDown() {
|
||||
SimpAttributesContextHolder.resetAttributes();
|
||||
}
|
||||
|
||||
@@ -26,13 +26,13 @@ import java.util.Map;
|
||||
import javax.security.auth.Subject;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.core.annotation.AliasFor;
|
||||
@@ -69,7 +69,7 @@ import static org.mockito.Mockito.verify;
|
||||
* @author Sebastien Deleuze
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class SendToMethodReturnValueHandlerTests {
|
||||
|
||||
private static final MimeType MIME_TYPE = new MimeType("text", "plain", StandardCharsets.UTF_8);
|
||||
@@ -120,7 +120,7 @@ public class SendToMethodReturnValueHandlerTests {
|
||||
}
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() throws Exception {
|
||||
SimpMessagingTemplate messagingTemplate = new SimpMessagingTemplate(this.messageChannel);
|
||||
messagingTemplate.setMessageConverter(new StringMessageConverter());
|
||||
|
||||
@@ -25,13 +25,13 @@ import java.util.Optional;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import reactor.core.publisher.EmitterProcessor;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.FluxProcessor;
|
||||
@@ -81,7 +81,7 @@ import static org.mockito.Mockito.verify;
|
||||
* @author Brian Clozel
|
||||
* @author Sebastien Deleuze
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class SimpAnnotationMethodMessageHandlerTests {
|
||||
|
||||
private static final String TEST_INVALID_VALUE = "invalidValue";
|
||||
@@ -101,7 +101,7 @@ public class SimpAnnotationMethodMessageHandlerTests {
|
||||
private TestController testController = new TestController();
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
SimpMessagingTemplate brokerTemplate = new SimpMessagingTemplate(this.channel);
|
||||
brokerTemplate.setMessageConverter(this.converter);
|
||||
|
||||
@@ -21,13 +21,13 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.security.Principal;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.messaging.Message;
|
||||
@@ -58,7 +58,7 @@ import static org.mockito.Mockito.verify;
|
||||
* @author Rossen Stoyanchev
|
||||
* @author Sebastien Deleuze
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class SubscriptionMethodReturnValueHandlerTests {
|
||||
|
||||
public static final MimeType MIME_TYPE = new MimeType("text", "plain", StandardCharsets.UTF_8);
|
||||
@@ -85,7 +85,7 @@ public class SubscriptionMethodReturnValueHandlerTests {
|
||||
private MethodParameter subscribeEventJsonViewReturnType;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() throws Exception {
|
||||
SimpMessagingTemplate messagingTemplate = new SimpMessagingTemplate(this.messageChannel);
|
||||
messagingTemplate.setMessageConverter(new StringMessageConverter());
|
||||
|
||||
@@ -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.context.ApplicationEvent;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.simp.SimpMessageHeaderAccessor;
|
||||
|
||||
@@ -23,9 +23,9 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.messaging.simp.SimpMessageHeaderAccessor;
|
||||
import org.springframework.messaging.simp.SimpMessageType;
|
||||
@@ -51,7 +51,7 @@ public class OrderedMessageSenderTests {
|
||||
private ThreadPoolTaskExecutor executor;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.executor = new ThreadPoolTaskExecutor();
|
||||
this.executor.setCorePoolSize(Runtime.getRuntime().availableProcessors() * 2);
|
||||
@@ -65,7 +65,7 @@ public class OrderedMessageSenderTests {
|
||||
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void tearDown() {
|
||||
this.executor.shutdown();
|
||||
}
|
||||
|
||||
@@ -21,13 +21,13 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
@@ -57,7 +57,7 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 4.0
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@SuppressWarnings("unchecked")
|
||||
public class SimpleBrokerMessageHandlerTests {
|
||||
|
||||
@@ -80,7 +80,7 @@ public class SimpleBrokerMessageHandlerTests {
|
||||
ArgumentCaptor<Message<?>> messageCaptor;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.messageHandler = new SimpleBrokerMessageHandler(
|
||||
this.clientInChannel, this.clientOutChannel, this.brokerChannel, Collections.emptyList());
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.messaging.simp.config;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.StubMessageChannel;
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
|
||||
|
||||
@@ -23,13 +23,13 @@ import java.util.Map;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.junit.jupiter.MockitoSettings;
|
||||
import org.mockito.quality.Strictness;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageDeliveryException;
|
||||
@@ -64,7 +64,7 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@MockitoSettings(strictness = Strictness.LENIENT)
|
||||
public class DefaultStompSessionTests {
|
||||
|
||||
private DefaultStompSession session;
|
||||
@@ -82,7 +82,7 @@ public class DefaultStompSessionTests {
|
||||
private ArgumentCaptor<Message<byte[]>> messageCaptor;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
this.connectHeaders = new StompHeaders();
|
||||
this.session = new DefaultStompSession(this.sessionHandler, this.connectHeaders);
|
||||
|
||||
@@ -26,11 +26,10 @@ import java.util.concurrent.TimeUnit;
|
||||
import org.apache.activemq.broker.BrokerService;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TestName;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestInfo;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.messaging.converter.StringMessageConverter;
|
||||
@@ -46,23 +45,21 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* Integration tests for {@link ReactorNettyTcpStompClient}.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @author Sam Brannen
|
||||
*/
|
||||
public class ReactorNettyTcpStompClientTests {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(ReactorNettyTcpStompClientTests.class);
|
||||
|
||||
@Rule
|
||||
public final TestName testName = new TestName();
|
||||
|
||||
private BrokerService activeMQBroker;
|
||||
|
||||
private ReactorNettyTcpStompClient client;
|
||||
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
|
||||
logger.debug("Setting up before '" + this.testName.getMethodName() + "'");
|
||||
@BeforeEach
|
||||
public void setUp(TestInfo testInfo) throws Exception {
|
||||
logger.debug("Setting up before '" + testInfo.getTestMethod().get().getName() + "'");
|
||||
|
||||
int port = SocketUtils.findAvailableTcpPort(61613);
|
||||
|
||||
@@ -83,7 +80,7 @@ public class ReactorNettyTcpStompClientTests {
|
||||
this.client.setTaskScheduler(taskScheduler);
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void tearDown() throws Exception {
|
||||
try {
|
||||
this.client.shutdown();
|
||||
|
||||
@@ -28,11 +28,10 @@ import java.util.concurrent.TimeUnit;
|
||||
import org.apache.activemq.broker.BrokerService;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TestName;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestInfo;
|
||||
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
@@ -56,12 +55,10 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
* Integration tests for {@link StompBrokerRelayMessageHandler} running against ActiveMQ.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @author Sam Brannen
|
||||
*/
|
||||
public class StompBrokerRelayMessageHandlerIntegrationTests {
|
||||
|
||||
@Rule
|
||||
public final TestName testName = new TestName();
|
||||
|
||||
private static final Log logger = LogFactory.getLog(StompBrokerRelayMessageHandlerIntegrationTests.class);
|
||||
|
||||
private StompBrokerRelayMessageHandler relay;
|
||||
@@ -77,9 +74,10 @@ public class StompBrokerRelayMessageHandlerIntegrationTests {
|
||||
private int port;
|
||||
|
||||
|
||||
@Before
|
||||
public void setup() throws Exception {
|
||||
logger.debug("Setting up before '" + this.testName.getMethodName() + "'");
|
||||
@BeforeEach
|
||||
public void setUp(TestInfo testInfo) throws Exception {
|
||||
logger.debug("Setting up before '" + testInfo.getTestMethod().get().getName() + "'");
|
||||
|
||||
this.port = SocketUtils.findAvailableTcpPort(61613);
|
||||
this.responseChannel = new ExecutorSubscribableChannel();
|
||||
this.responseHandler = new TestMessageHandler();
|
||||
@@ -114,7 +112,7 @@ public class StompBrokerRelayMessageHandlerIntegrationTests {
|
||||
this.eventPublisher.expectBrokerAvailabilityEvent(true);
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void stop() throws Exception {
|
||||
try {
|
||||
logger.debug("STOMP broker relay stats: " + this.relay.getStatsInfo());
|
||||
@@ -133,6 +131,7 @@ public class StompBrokerRelayMessageHandlerIntegrationTests {
|
||||
}
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
this.activeMQBroker.addShutdownHook(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
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 org.mockito.ArgumentCaptor;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
@@ -59,7 +59,7 @@ public class StompBrokerRelayMessageHandlerTests {
|
||||
private StubTcpOperations tcpClient;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
|
||||
this.outboundChannel = new StubMessageChannel();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.messaging.simp.stomp;
|
||||
|
||||
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;
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.Collection;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.messaging.simp.SimpMessageType;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.io.UnsupportedEncodingException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.simp.SimpMessageType;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.messaging.simp.stomp;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.support.MessageBuilder;
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHeaders;
|
||||
|
||||
@@ -18,8 +18,8 @@ package org.springframework.messaging.simp.user;
|
||||
|
||||
import java.security.Principal;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.simp.SimpMessageHeaderAccessor;
|
||||
@@ -45,7 +45,7 @@ public class DefaultUserDestinationResolverTests {
|
||||
private SimpUserRegistry registry;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
TestSimpUser simpUser = new TestSimpUser("joe");
|
||||
simpUser.addSessions(new TestSimpSession("123"));
|
||||
|
||||
@@ -22,8 +22,8 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
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.mockito.Mockito;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
@@ -48,7 +48,7 @@ public class MultiServerUserRegistryTests {
|
||||
private MessageConverter converter;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() throws Exception {
|
||||
this.localRegistry = Mockito.mock(SimpUserRegistry.class);
|
||||
this.registry = new MultiServerUserRegistry(this.localRegistry);
|
||||
|
||||
@@ -18,8 +18,8 @@ package org.springframework.messaging.simp.user;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
@@ -54,7 +54,7 @@ public class UserDestinationMessageHandlerTests {
|
||||
private SubscribableChannel brokerChannel;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.registry = mock(SimpUserRegistry.class);
|
||||
this.brokerChannel = mock(SubscribableChannel.class);
|
||||
|
||||
@@ -21,12 +21,12 @@ import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
@@ -50,7 +50,7 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
* User tests for {@link UserRegistryMessageHandler}.
|
||||
* @author Rossen Stoyanchev
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class UserRegistryMessageHandlerTests {
|
||||
|
||||
private UserRegistryMessageHandler handler;
|
||||
@@ -69,9 +69,8 @@ public class UserRegistryMessageHandlerTests {
|
||||
private TaskScheduler taskScheduler;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
given(this.brokerChannel.send(any())).willReturn(true);
|
||||
this.converter = new MappingJackson2MessageConverter();
|
||||
|
||||
SimpMessagingTemplate brokerTemplate = new SimpMessagingTemplate(this.brokerChannel);
|
||||
@@ -108,6 +107,7 @@ public class UserRegistryMessageHandlerTests {
|
||||
|
||||
@Test
|
||||
public void broadcastRegistry() throws Exception {
|
||||
given(this.brokerChannel.send(any())).willReturn(true);
|
||||
|
||||
TestSimpUser simpUser1 = new TestSimpUser("joe");
|
||||
TestSimpUser simpUser2 = new TestSimpUser("jane");
|
||||
|
||||
@@ -21,8 +21,8 @@ import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
@@ -44,7 +44,7 @@ public class ChannelInterceptorTests {
|
||||
private TestMessageHandler messageHandler;
|
||||
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.channel = new ExecutorSubscribableChannel();
|
||||
this.messageHandler = new TestMessageHandler();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.messaging.support;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
@@ -18,12 +18,12 @@ package org.springframework.messaging.support;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
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.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.messaging.Message;
|
||||
@@ -46,7 +46,7 @@ import static org.mockito.Mockito.verifyZeroInteractions;
|
||||
*
|
||||
* @author Phillip Webb
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class ExecutorSubscribableChannelTests {
|
||||
|
||||
private ExecutorSubscribableChannel channel = new ExecutorSubscribableChannel();
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHeaders;
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHeaders;
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
|
||||
@@ -26,9 +26,9 @@ import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.flow
|
||||
import kotlinx.coroutines.flow.map
|
||||
import org.junit.AfterClass
|
||||
import org.junit.BeforeClass
|
||||
import org.junit.Test
|
||||
import org.junit.jupiter.api.AfterAll
|
||||
import org.junit.jupiter.api.BeforeAll
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
@@ -194,7 +194,7 @@ class RSocketClientToServerCoroutinesIntegrationTests {
|
||||
private lateinit var requester: RSocketRequester
|
||||
|
||||
|
||||
@BeforeClass
|
||||
@BeforeAll
|
||||
@JvmStatic
|
||||
fun setupOnce() {
|
||||
context = AnnotationConfigApplicationContext(ServerConfig::class.java)
|
||||
@@ -214,7 +214,7 @@ class RSocketClientToServerCoroutinesIntegrationTests {
|
||||
.block()!!
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@AfterAll
|
||||
@JvmStatic
|
||||
fun tearDownOnce() {
|
||||
requester.rsocket().dispose()
|
||||
|
||||
@@ -7,7 +7,7 @@ import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.toList
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.ArgumentMatchers.anyInt
|
||||
import org.reactivestreams.Publisher
|
||||
import org.springframework.core.ParameterizedTypeReference
|
||||
@@ -136,4 +136,5 @@ class RSocketRequesterExtensionsTests {
|
||||
assertEquals(listOf("foo", "bar"), responseSpec.retrieveFlux<String>().collectList().block())
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@ import io.mockk.mockk
|
||||
import java.util.Collections
|
||||
import java.util.HashMap
|
||||
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
import org.springframework.context.support.StaticApplicationContext
|
||||
import org.springframework.messaging.Message
|
||||
@@ -47,7 +47,6 @@ import org.springframework.messaging.handler.annotation.MessageExceptionHandler
|
||||
*/
|
||||
class SimpAnnotationMethodMessageHandlerKotlinTests {
|
||||
|
||||
|
||||
lateinit var messageHandler: TestSimpAnnotationMethodMessageHandler
|
||||
|
||||
lateinit var testController: TestController
|
||||
@@ -56,7 +55,7 @@ class SimpAnnotationMethodMessageHandlerKotlinTests {
|
||||
|
||||
val converter = mockk<MessageConverter>(relaxed = true)
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
fun setup() {
|
||||
val brokerTemplate = SimpMessagingTemplate(channel)
|
||||
brokerTemplate.messageConverter = converter
|
||||
|
||||
Reference in New Issue
Block a user