Add error stream tests for Jaxb2XmlDecoderTests
Issue: SPR-17418
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,9 +38,7 @@ import org.springframework.http.codec.xml.jaxb.XmlType;
|
||||
import org.springframework.http.codec.xml.jaxb.XmlTypeWithName;
|
||||
import org.springframework.http.codec.xml.jaxb.XmlTypeWithNameAndNamespace;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author Sebastien Deleuze
|
||||
@@ -207,6 +205,19 @@ public class Jaxb2XmlDecoderTests extends AbstractDataBufferAllocatingTestCase {
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void decodeError() throws Exception {
|
||||
Flux<DataBuffer> source = Flux.just(stringBuffer("<pojo>"))
|
||||
.concatWith(Flux.error(new RuntimeException()));
|
||||
|
||||
Mono<Object> output = this.decoder.decodeToMono(source, ResolvableType.forClass(Pojo.class),
|
||||
null, Collections.emptyMap());
|
||||
|
||||
StepVerifier.create(output)
|
||||
.expectError(RuntimeException.class)
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toExpectedQName() {
|
||||
assertEquals(new QName("pojo"), this.decoder.toQName(Pojo.class));
|
||||
|
||||
Reference in New Issue
Block a user