Fix error handling in Jackson2JsonDecoder

Issue: SPR-15112
This commit is contained in:
Sebastien Deleuze
2017-01-09 14:51:16 +01:00
parent e4a599f961
commit aa43472f2e
2 changed files with 12 additions and 1 deletions

View File

@@ -28,6 +28,7 @@ import reactor.core.publisher.Mono;
import reactor.test.StepVerifier;
import org.springframework.core.ResolvableType;
import org.springframework.core.codec.CodecException;
import org.springframework.core.io.buffer.AbstractDataBufferAllocatingTestCase;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.http.MediaType;
@@ -67,6 +68,16 @@ public class Jackson2JsonDecoderTests extends AbstractDataBufferAllocatingTestCa
.verify();
}
@Test
public void decodePojoWithError() throws Exception {
Flux<DataBuffer> source = Flux.just(stringBuffer("{\"foo\":}"));
ResolvableType elementType = ResolvableType.forClass(Pojo.class);
Flux<Object> flux = new Jackson2JsonDecoder().decode(source, elementType, null,
Collections.emptyMap());
StepVerifier.create(flux).verifyError(CodecException.class);
}
@Test
public void decodeToList() throws Exception {
Flux<DataBuffer> source = Flux.just(stringBuffer(