Skip to content

Commit 47fe050

Browse files
committed
Add error stream tests for Jaxb2XmlDecoderTests
Issue: SPR-17418
1 parent a37efc9 commit 47fe050

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

spring-web/src/test/java/org/springframework/http/codec/xml/Jaxb2XmlDecoderTests.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -38,9 +38,7 @@
3838
import org.springframework.http.codec.xml.jaxb.XmlTypeWithName;
3939
import org.springframework.http.codec.xml.jaxb.XmlTypeWithNameAndNamespace;
4040

41-
import static org.junit.Assert.assertEquals;
42-
import static org.junit.Assert.assertFalse;
43-
import static org.junit.Assert.assertTrue;
41+
import static org.junit.Assert.*;
4442

4543
/**
4644
* @author Sebastien Deleuze
@@ -207,6 +205,19 @@ public void decodeMultipleXmlTypeElement() throws Exception {
207205
.verify();
208206
}
209207

208+
@Test
209+
public void decodeError() throws Exception {
210+
Flux<DataBuffer> source = Flux.just(stringBuffer("<pojo>"))
211+
.concatWith(Flux.error(new RuntimeException()));
212+
213+
Mono<Object> output = this.decoder.decodeToMono(source, ResolvableType.forClass(Pojo.class),
214+
null, Collections.emptyMap());
215+
216+
StepVerifier.create(output)
217+
.expectError(RuntimeException.class)
218+
.verify();
219+
}
220+
210221
@Test
211222
public void toExpectedQName() {
212223
assertEquals(new QName("pojo"), this.decoder.toQName(Pojo.class));

0 commit comments

Comments
 (0)