Re-enable shadowed, overridden @Test and lifecycle methods
Due to a bug (or "unintentional feature") in JUnit 4, overridden test and lifecycle methods not annotated with @Test, @Before, @After, etc. are still executed as test methods and lifecycle methods; however, JUnit Jupiter does not support that. Thus, prior to this commit, some overridden test and lifecycle methods were no longer executed after the migration from JUnit 4 to JUnit Jupiter. This commit addresses this issue for such known use cases, but there are likely other such use cases within Spring's test suite. See gh-23451
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,6 +22,7 @@ import java.util.concurrent.RunnableFuture;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.task.AsyncListenableTaskExecutor;
|
||||
@@ -44,6 +45,7 @@ public class ConcurrentTaskExecutorTests extends AbstractSchedulingTaskExecutorT
|
||||
}
|
||||
|
||||
@Override
|
||||
@AfterEach
|
||||
public void shutdownExecutor() {
|
||||
List<Runnable> remainingTasks = concurrentExecutor.shutdownNow();
|
||||
for (Runnable task : remainingTasks) {
|
||||
|
||||
@@ -52,6 +52,7 @@ public class AnnotationDrivenNamespaceTests extends AbstractJmsAnnotationDrivenT
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test
|
||||
public void fullConfigurableConfiguration() {
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"annotation-driven-full-configurable-config.xml", getClass());
|
||||
|
||||
@@ -71,6 +71,7 @@ public class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test
|
||||
public void fullConfigurableConfiguration() {
|
||||
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(
|
||||
EnableJmsFullConfigurableConfig.class, FullConfigurableBean.class);
|
||||
|
||||
@@ -90,6 +90,7 @@ public class Jackson2CborDecoderTests extends AbstractDecoderTestCase<Jackson2Cb
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test
|
||||
public void decodeToMono() {
|
||||
List<Pojo> expected = Arrays.asList(pojo1, pojo2);
|
||||
|
||||
|
||||
@@ -115,6 +115,7 @@ public class Jackson2JsonDecoderTests extends AbstractDecoderTestCase<Jackson2Js
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test
|
||||
public void decodeToMono() {
|
||||
Flux<DataBuffer> input = Flux.concat(
|
||||
stringBuffer("[{\"bar\":\"b1\",\"foo\":\"f1\"},"),
|
||||
|
||||
@@ -57,7 +57,6 @@ import static org.springframework.http.codec.json.Jackson2CodecSupport.JSON_VIEW
|
||||
*/
|
||||
public class Jackson2JsonEncoderTests extends AbstractEncoderTestCase<Jackson2JsonEncoder> {
|
||||
|
||||
|
||||
public Jackson2JsonEncoderTests() {
|
||||
super(new Jackson2JsonEncoder());
|
||||
}
|
||||
@@ -78,6 +77,7 @@ public class Jackson2JsonEncoderTests extends AbstractEncoderTestCase<Jackson2Js
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test
|
||||
public void encode() throws Exception {
|
||||
Flux<Object> input = Flux.just(new Pojo("foo", "bar"),
|
||||
new Pojo("foofoo", "barbar"),
|
||||
|
||||
@@ -67,6 +67,7 @@ public class Jackson2SmileDecoderTests extends AbstractDecoderTestCase<Jackson2S
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test
|
||||
public void decode() {
|
||||
Flux<DataBuffer> input = Flux.just(this.pojo1, this.pojo2)
|
||||
.map(this::writeObject)
|
||||
@@ -90,6 +91,7 @@ public class Jackson2SmileDecoderTests extends AbstractDecoderTestCase<Jackson2S
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test
|
||||
public void decodeToMono() {
|
||||
List<Pojo> expected = Arrays.asList(pojo1, pojo2);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user