Browse Source

Add error stream tests for Jaxb2XmlDecoderTests

Issue: SPR-17418
pull/1999/head
Arjen Poutsma 7 years ago
parent
commit
47fe05066d
  1. 19
      spring-web/src/test/java/org/springframework/http/codec/xml/Jaxb2XmlDecoderTests.java

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

@ -1,5 +1,5 @@ @@ -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; @@ -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 { @@ -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));

Loading…
Cancel
Save