Skip to content

Commit 9572859

Browse files
committed
Expect IOException instead of HttpMessageNotReadableException
1 parent 78931ee commit 9572859

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

spring-web/src/test/java/org/springframework/http/converter/xml/MappingJackson2XmlHttpMessageConverterTests.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2017 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.
@@ -32,7 +32,6 @@
3232
import org.springframework.http.MockHttpInputMessage;
3333
import org.springframework.http.MockHttpOutputMessage;
3434
import org.springframework.http.converter.AbstractHttpMessageConverter;
35-
import org.springframework.http.converter.HttpMessageNotReadableException;
3635
import org.springframework.http.converter.json.MappingJacksonValue;
3736

3837
import static org.hamcrest.CoreMatchers.*;
@@ -103,7 +102,7 @@ public void write() throws IOException {
103102
outputMessage.getHeaders().getContentType());
104103
}
105104

106-
@Test(expected = HttpMessageNotReadableException.class)
105+
@Test(expected = IOException.class)
107106
public void readInvalidXml() throws IOException {
108107
String body = "FooBar";
109108
MockHttpInputMessage inputMessage = new MockHttpInputMessage(body.getBytes("UTF-8"));
@@ -155,7 +154,7 @@ public void readWithExternalReference() throws IOException {
155154
MockHttpInputMessage inputMessage = new MockHttpInputMessage(body.getBytes("UTF-8"));
156155
inputMessage.getHeaders().setContentType(new MediaType("application", "xml"));
157156

158-
this.thrown.expect(HttpMessageNotReadableException.class);
157+
this.thrown.expect(IOException.class);
159158
this.converter.read(MyBean.class, inputMessage);
160159
}
161160

@@ -182,7 +181,7 @@ public void readWithXmlBomb() throws IOException {
182181
MockHttpInputMessage inputMessage = new MockHttpInputMessage(body.getBytes("UTF-8"));
183182
inputMessage.getHeaders().setContentType(new MediaType("application", "xml"));
184183

185-
this.thrown.expect(HttpMessageNotReadableException.class);
184+
this.thrown.expect(IOException.class);
186185
this.converter.read(MyBean.class, inputMessage);
187186
}
188187

0 commit comments

Comments
 (0)