@ -35,9 +35,7 @@ import org.springframework.protobuf.SecondMsg;
@@ -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 {
@@ -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 ( ) ;