@ -29,7 +29,6 @@ import org.junit.Before;
@@ -29,7 +29,6 @@ import org.junit.Before;
import org.junit.Test ;
import reactor.core.publisher.Flux ;
import reactor.core.publisher.Mono ;
import reactor.test.StepVerifier ;
import org.springframework.core.codec.StringDecoder ;
import org.springframework.core.io.buffer.DataBuffer ;
@ -48,7 +47,7 @@ import org.springframework.util.MultiValueMap;
@@ -48,7 +47,7 @@ import org.springframework.util.MultiValueMap;
import static org.junit.Assert.* ;
import static org.mockito.Mockito.* ;
import static org.springframework.web.reactive.function.BodyExtractors.* ;
import static org.springframework.web.reactive.function.BodyExtractors.toMono ;
/ * *
* @author Arjen Poutsma
@ -151,24 +150,6 @@ public class DefaultClientResponseTests {
@@ -151,24 +150,6 @@ public class DefaultClientResponseTests {
assertEquals ( "foo" , resultMono . block ( ) ) ;
}
@Test
public void bodyToMonoError ( ) throws Exception {
HttpHeaders httpHeaders = new HttpHeaders ( ) ;
httpHeaders . setContentType ( MediaType . TEXT_PLAIN ) ;
when ( mockResponse . getHeaders ( ) ) . thenReturn ( httpHeaders ) ;
when ( mockResponse . getStatusCode ( ) ) . thenReturn ( HttpStatus . NOT_FOUND ) ;
Set < HttpMessageReader < ? > > messageReaders = Collections
. singleton ( new DecoderHttpMessageReader < > ( StringDecoder . allMimeTypes ( true ) ) ) ;
when ( mockExchangeStrategies . messageReaders ( ) ) . thenReturn ( messageReaders : : stream ) ;
Mono < String > resultMono = defaultClientResponse . bodyToMono ( String . class ) ;
StepVerifier . create ( resultMono )
. expectError ( WebClientException . class )
. verify ( ) ;
}
@Test
public void bodyToFlux ( ) throws Exception {
DefaultDataBufferFactory factory = new DefaultDataBufferFactory ( ) ;
@ -191,21 +172,4 @@ public class DefaultClientResponseTests {
@@ -191,21 +172,4 @@ public class DefaultClientResponseTests {
assertEquals ( Collections . singletonList ( "foo" ) , result . block ( ) ) ;
}
@Test
public void bodyToFluxError ( ) throws Exception {
HttpHeaders httpHeaders = new HttpHeaders ( ) ;
httpHeaders . setContentType ( MediaType . TEXT_PLAIN ) ;
when ( mockResponse . getHeaders ( ) ) . thenReturn ( httpHeaders ) ;
when ( mockResponse . getStatusCode ( ) ) . thenReturn ( HttpStatus . INTERNAL_SERVER_ERROR ) ;
Set < HttpMessageReader < ? > > messageReaders = Collections
. singleton ( new DecoderHttpMessageReader < > ( StringDecoder . allMimeTypes ( true ) ) ) ;
when ( mockExchangeStrategies . messageReaders ( ) ) . thenReturn ( messageReaders : : stream ) ;
Flux < String > resultFlux = defaultClientResponse . bodyToFlux ( String . class ) ;
StepVerifier . create ( resultFlux )
. expectError ( WebClientException . class )
. verify ( ) ;
}
}