Fix test failure

Issue: SPR-15548
Closes gh-1488
This commit is contained in:
Stephane Nicoll 2017-07-31 10:45:18 +02:00
parent 48f18e9a47
commit 1a9cfefcbb
1 changed files with 5 additions and 3 deletions

View File

@ -29,6 +29,7 @@ import org.springframework.core.io.ClassPathResource;
import org.springframework.http.MediaType;
import org.springframework.http.MockHttpInputMessage;
import org.springframework.http.MockHttpOutputMessage;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.http.converter.json.MappingJacksonValue;
import static org.hamcrest.CoreMatchers.*;
@ -98,11 +99,12 @@ public class MappingJackson2XmlHttpMessageConverterTests {
outputMessage.getHeaders().getContentType());
}
@Test(expected = IOException.class)
@Test
public void readInvalidXml() throws IOException {
String body = "FooBar";
MockHttpInputMessage inputMessage = new MockHttpInputMessage(body.getBytes("UTF-8"));
inputMessage.getHeaders().setContentType(new MediaType("application", "xml"));
this.thrown.expect(HttpMessageNotReadableException.class);
converter.read(MyBean.class, inputMessage);
}
@ -150,7 +152,7 @@ public class MappingJackson2XmlHttpMessageConverterTests {
MockHttpInputMessage inputMessage = new MockHttpInputMessage(body.getBytes("UTF-8"));
inputMessage.getHeaders().setContentType(new MediaType("application", "xml"));
this.thrown.expect(IOException.class);
this.thrown.expect(HttpMessageNotReadableException.class);
this.converter.read(MyBean.class, inputMessage);
}
@ -177,7 +179,7 @@ public class MappingJackson2XmlHttpMessageConverterTests {
MockHttpInputMessage inputMessage = new MockHttpInputMessage(body.getBytes("UTF-8"));
inputMessage.getHeaders().setContentType(new MediaType("application", "xml"));
this.thrown.expect(IOException.class);
this.thrown.expect(HttpMessageNotReadableException.class);
this.converter.read(MyBean.class, inputMessage);
}