Clean up warnings and polish tests
This commit also modifies ResourceWebHandlerTests.getResourceFromFileSystem() so that it passes in the IDE.
This commit is contained in:
@@ -42,8 +42,8 @@ class Netty5BufferEncoderTests extends AbstractEncoderTests<Netty5BufferEncoder>
|
||||
super(new Netty5BufferEncoder());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test
|
||||
@Override
|
||||
public void canEncode() {
|
||||
assertThat(this.encoder.canEncode(ResolvableType.forClass(Buffer.class),
|
||||
MimeTypeUtils.TEXT_PLAIN)).isTrue();
|
||||
@@ -56,8 +56,9 @@ class Netty5BufferEncoderTests extends AbstractEncoderTests<Netty5BufferEncoder>
|
||||
assertThat(this.encoder.canEncode(ResolvableType.NONE, null)).isFalse();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test
|
||||
@Override
|
||||
@SuppressWarnings("resource")
|
||||
public void encode() {
|
||||
Flux<Buffer> input = Flux.just(this.fooBytes, this.barBytes)
|
||||
.map(DefaultBufferAllocators.preferredAllocator()::copyOf);
|
||||
@@ -67,4 +68,5 @@ class Netty5BufferEncoderTests extends AbstractEncoderTests<Netty5BufferEncoder>
|
||||
.consumeNextWith(expectBytes(this.barBytes))
|
||||
.verifyComplete());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -389,6 +389,7 @@ class DataBufferTests extends AbstractDataBufferAllocatingTests {
|
||||
}
|
||||
|
||||
@ParameterizedDataBufferAllocatingTest
|
||||
@SuppressWarnings("deprecation")
|
||||
void increaseCapacity(DataBufferFactory bufferFactory) {
|
||||
super.bufferFactory = bufferFactory;
|
||||
|
||||
@@ -402,6 +403,7 @@ class DataBufferTests extends AbstractDataBufferAllocatingTests {
|
||||
}
|
||||
|
||||
@ParameterizedDataBufferAllocatingTest
|
||||
@SuppressWarnings("deprecation")
|
||||
void decreaseCapacityLowReadPosition(DataBufferFactory bufferFactory) {
|
||||
assumeFalse(bufferFactory instanceof Netty5DataBufferFactory,
|
||||
"Netty 5 does not support decreasing the capacity");
|
||||
@@ -417,6 +419,7 @@ class DataBufferTests extends AbstractDataBufferAllocatingTests {
|
||||
}
|
||||
|
||||
@ParameterizedDataBufferAllocatingTest
|
||||
@SuppressWarnings("deprecation")
|
||||
void decreaseCapacityHighReadPosition(DataBufferFactory bufferFactory) {
|
||||
assumeFalse(bufferFactory instanceof Netty5DataBufferFactory,
|
||||
"Netty 5 does not support decreasing the capacity");
|
||||
@@ -433,13 +436,13 @@ class DataBufferTests extends AbstractDataBufferAllocatingTests {
|
||||
}
|
||||
|
||||
@ParameterizedDataBufferAllocatingTest
|
||||
@SuppressWarnings("deprecation")
|
||||
void capacityLessThanZero(DataBufferFactory bufferFactory) {
|
||||
super.bufferFactory = bufferFactory;
|
||||
|
||||
DataBuffer buffer = createDataBuffer(1);
|
||||
try {
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
buffer.capacity(-1));
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> buffer.capacity(-1));
|
||||
}
|
||||
finally {
|
||||
release(buffer);
|
||||
@@ -754,6 +757,7 @@ class DataBufferTests extends AbstractDataBufferAllocatingTests {
|
||||
}
|
||||
|
||||
@ParameterizedDataBufferAllocatingTest
|
||||
@SuppressWarnings("deprecation")
|
||||
void spr16351(DataBufferFactory bufferFactory) {
|
||||
super.bufferFactory = bufferFactory;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
@@ -32,11 +32,11 @@ class LeakAwareDataBufferFactoryTests {
|
||||
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
void leak() {
|
||||
DataBuffer dataBuffer = this.bufferFactory.allocateBuffer();
|
||||
try {
|
||||
assertThatExceptionOfType(AssertionError.class).isThrownBy(
|
||||
this.bufferFactory::checkForLeaks);
|
||||
assertThatExceptionOfType(AssertionError.class).isThrownBy(this.bufferFactory::checkForLeaks);
|
||||
}
|
||||
finally {
|
||||
release(dataBuffer);
|
||||
@@ -45,7 +45,7 @@ class LeakAwareDataBufferFactoryTests {
|
||||
|
||||
@Test
|
||||
void noLeak() {
|
||||
DataBuffer dataBuffer = this.bufferFactory.allocateBuffer();
|
||||
DataBuffer dataBuffer = this.bufferFactory.allocateBuffer(256);
|
||||
release(dataBuffer);
|
||||
this.bufferFactory.checkForLeaks();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user