提交 11a017d8 编写于 作者: A Arjen Poutsma

Add error stream tests for ProtobufEncoderTests

Issue: SPR-17419
上级 2439f87a
......@@ -35,9 +35,7 @@ import org.springframework.protobuf.SecondMsg;
import org.springframework.util.MimeType;
import static java.util.Collections.emptyMap;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;
import static org.springframework.core.ResolvableType.forClass;
/**
......@@ -80,6 +78,19 @@ public class ProtobufEncoderTests extends AbstractDataBufferAllocatingTestCase {
.verifyComplete();
}
@Test
public void encodeError() {
Flux<Msg> messages = Flux.just(this.testMsg)
.concatWith(Flux.error(new RuntimeException()));
ResolvableType elementType = forClass(Msg.class);
Flux<DataBuffer> output = this.encoder.encode(messages, this.bufferFactory, elementType, PROTOBUF_MIME_TYPE, emptyMap());
StepVerifier.create(output)
.consumeNextWith(DataBufferUtils::release)
.expectError(RuntimeException.class)
.verify();
}
@Test
public void encodeStream() {
Msg testMsg2 = Msg.newBuilder().setFoo("Bar").setBlah(SecondMsg.newBuilder().setBlah(456).build()).build();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册