Remove dumpString from DataBufferTestUtils

See gh-24786
This commit is contained in:
Rossen Stoyanchev
2020-03-26 21:41:45 +00:00
parent 7aa06b8610
commit 3175f0771e
21 changed files with 60 additions and 102 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@@ -33,7 +33,6 @@ import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.core.io.buffer.DataBufferUtils;
import org.springframework.core.io.support.ResourceRegion;
import org.springframework.core.testfixture.io.buffer.AbstractLeakCheckingTests;
import org.springframework.core.testfixture.io.buffer.DataBufferTestUtils;
import org.springframework.util.MimeType;
import org.springframework.util.MimeTypeUtils;
@@ -182,7 +181,7 @@ class ResourceRegionEncoderTests extends AbstractLeakCheckingTests {
protected Consumer<DataBuffer> stringConsumer(String expected) {
return dataBuffer -> {
String value = DataBufferTestUtils.dumpString(dataBuffer, UTF_8);
String value = dataBuffer.toString(UTF_8);
DataBufferUtils.release(dataBuffer);
assertThat(value).isEqualTo(expected);
};

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@@ -46,7 +46,6 @@ import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.testfixture.io.buffer.AbstractDataBufferAllocatingTests;
import org.springframework.core.testfixture.io.buffer.DataBufferTestUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
@@ -815,7 +814,7 @@ class DataBufferUtilsTests extends AbstractDataBufferAllocatingTests {
StepVerifier.create(result)
.consumeNextWith(buf -> {
assertThat(DataBufferTestUtils.dumpString(buf, StandardCharsets.UTF_8)).isEqualTo("foobarbaz");
assertThat(buf.toString(StandardCharsets.UTF_8)).isEqualTo("foobarbaz");
release(buf);
})
.verifyComplete();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@@ -53,12 +53,10 @@ class DataBufferTestUtilsTests extends AbstractDataBufferAllocatingTests {
DataBuffer buffer = this.bufferFactory.allocateBuffer(4);
String source = "abcd";
buffer.write(source.getBytes(StandardCharsets.UTF_8));
String result = DataBufferTestUtils.dumpString(buffer, StandardCharsets.UTF_8);
String result = buffer.toString(StandardCharsets.UTF_8);
release(buffer);
assertThat(result).isEqualTo(source);
release(buffer);
}
}