Replace remaining use of block operator

This commit is contained in:
Rossen Stoyanchev
2018-03-31 11:17:44 -04:00
parent 129c05bcff
commit 4454ffd2b1
3 changed files with 42 additions and 15 deletions

View File

@@ -20,9 +20,9 @@ import java.net.URI;
import org.junit.Test;
import reactor.core.publisher.Mono;
import reactor.test.StepVerifier;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.core.io.buffer.DataBufferUtils;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
@@ -103,12 +103,15 @@ public class MultipartIntegrationTests extends AbstractHttpHandlerIntegrationTes
assertEquals("fooPart", part.name());
assertTrue(part instanceof FilePart);
assertEquals("foo.txt", ((FilePart) part).filename());
DataBufferUtils.join(part.content()).subscribe(buffer -> {
assertEquals(12, buffer.readableByteCount());
byte[] byteContent = new byte[12];
buffer.read(byteContent);
assertEquals("Lorem Ipsum.", new String(byteContent));
});
StepVerifier.create(DataBufferUtils.join(part.content()))
.consumeNextWith(buffer -> {
assertEquals(12, buffer.readableByteCount());
byte[] byteContent = new byte[12];
buffer.read(byteContent);
assertEquals("Lorem Ipsum.", new String(byteContent));
})
.verifyComplete();
}
private void assertBarPart(Part part) {