Re-enable shadowed, overridden @Test methods
Due to a bug (or "unintentional feature") in JUnit 4, overridden test methods not annotated with @Test are still executed as test methods; however, JUnit Jupiter does not support that. Thus, prior to this commit, some overridden test methods in spring-core 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:
parent
fab96cad67
commit
aa6e762dcf
|
@ -55,6 +55,7 @@ class ByteArrayEncoderTests extends AbstractEncoderTestCase<ByteArrayEncoder> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Test
|
||||||
public void encode() {
|
public void encode() {
|
||||||
Flux<byte[]> input = Flux.just(this.fooBytes, this.barBytes);
|
Flux<byte[]> input = Flux.just(this.fooBytes, this.barBytes);
|
||||||
|
|
||||||
|
@ -63,4 +64,5 @@ class ByteArrayEncoderTests extends AbstractEncoderTestCase<ByteArrayEncoder> {
|
||||||
.consumeNextWith(expectBytes(this.barBytes))
|
.consumeNextWith(expectBytes(this.barBytes))
|
||||||
.verifyComplete());
|
.verifyComplete());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ class CharSequenceEncoderTests extends AbstractEncoderTestCase<CharSequenceEncod
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Test
|
||||||
public void canEncode() throws Exception {
|
public void canEncode() throws Exception {
|
||||||
assertThat(this.encoder.canEncode(ResolvableType.forClass(String.class),
|
assertThat(this.encoder.canEncode(ResolvableType.forClass(String.class),
|
||||||
MimeTypeUtils.TEXT_PLAIN)).isTrue();
|
MimeTypeUtils.TEXT_PLAIN)).isTrue();
|
||||||
|
@ -63,6 +64,7 @@ class CharSequenceEncoderTests extends AbstractEncoderTestCase<CharSequenceEncod
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Test
|
||||||
public void encode() {
|
public void encode() {
|
||||||
Flux<CharSequence> input = Flux.just(this.foo, this.bar);
|
Flux<CharSequence> input = Flux.just(this.foo, this.bar);
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,7 @@ class DataBufferDecoderTests extends AbstractDecoderTestCase<DataBufferDecoder>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Test
|
||||||
public void decode() {
|
public void decode() {
|
||||||
Flux<DataBuffer> input = Flux.just(
|
Flux<DataBuffer> input = Flux.just(
|
||||||
this.bufferFactory.wrap(this.fooBytes),
|
this.bufferFactory.wrap(this.fooBytes),
|
||||||
|
@ -67,6 +68,7 @@ class DataBufferDecoderTests extends AbstractDecoderTestCase<DataBufferDecoder>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Test
|
||||||
public void decodeToMono() throws Exception {
|
public void decodeToMono() throws Exception {
|
||||||
Flux<DataBuffer> input = Flux.concat(
|
Flux<DataBuffer> input = Flux.concat(
|
||||||
dataBuffer(this.fooBytes),
|
dataBuffer(this.fooBytes),
|
||||||
|
|
|
@ -57,6 +57,7 @@ class DataBufferEncoderTests extends AbstractEncoderTestCase<DataBufferEncoder>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Test
|
||||||
public void encode() throws Exception {
|
public void encode() throws Exception {
|
||||||
Flux<DataBuffer> input = Flux.just(this.fooBytes, this.barBytes)
|
Flux<DataBuffer> input = Flux.just(this.fooBytes, this.barBytes)
|
||||||
.flatMap(bytes -> Mono.defer(() -> {
|
.flatMap(bytes -> Mono.defer(() -> {
|
||||||
|
|
|
@ -79,6 +79,7 @@ class ResourceDecoderTests extends AbstractDecoderTestCase<ResourceDecoder> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Test
|
||||||
public void decodeToMono() {
|
public void decodeToMono() {
|
||||||
Flux<DataBuffer> input = Flux.concat(
|
Flux<DataBuffer> input = Flux.concat(
|
||||||
dataBuffer(this.fooBytes),
|
dataBuffer(this.fooBytes),
|
||||||
|
|
|
@ -64,6 +64,7 @@ class ResourceEncoderTests extends AbstractEncoderTestCase<ResourceEncoder> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Test
|
||||||
public void encode() {
|
public void encode() {
|
||||||
Flux<Resource> input = Flux.just(new ByteArrayResource(this.bytes));
|
Flux<Resource> input = Flux.just(new ByteArrayResource(this.bytes));
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@ package org.springframework.core.type.classreading;
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import org.springframework.asm.ClassReader;
|
import org.springframework.asm.ClassReader;
|
||||||
import org.springframework.core.io.DefaultResourceLoader;
|
import org.springframework.core.io.DefaultResourceLoader;
|
||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
|
@ -61,6 +63,7 @@ class AnnotationMetadataReadingVisitorTests extends AbstractAnnotationMetadataTe
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Test
|
||||||
public void getAnnotationsReturnsDirectAnnotations() {
|
public void getAnnotationsReturnsDirectAnnotations() {
|
||||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(
|
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(
|
||||||
super::getAnnotationsReturnsDirectAnnotations);
|
super::getAnnotationsReturnsDirectAnnotations);
|
||||||
|
|
|
@ -19,6 +19,8 @@ package org.springframework.core.type.classreading;
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import org.springframework.asm.ClassReader;
|
import org.springframework.asm.ClassReader;
|
||||||
import org.springframework.core.io.DefaultResourceLoader;
|
import org.springframework.core.io.DefaultResourceLoader;
|
||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
|
@ -61,6 +63,7 @@ class MethodMetadataReadingVisitorTests extends AbstractMethodMetadataTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Test
|
||||||
public void getAnnotationsReturnsDirectAnnotations() {
|
public void getAnnotationsReturnsDirectAnnotations() {
|
||||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(
|
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(
|
||||||
super::getAnnotationsReturnsDirectAnnotations);
|
super::getAnnotationsReturnsDirectAnnotations);
|
||||||
|
|
Loading…
Reference in New Issue