Skip to content

Commit

Permalink
Fix test failure
Browse files Browse the repository at this point in the history
Issue: SPR-15548
Closes spring-projectsgh-1488
snicoll committed Jul 31, 2017

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 48f18e9 commit 1a9cfef
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -29,6 +29,7 @@
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 void write() throws IOException {
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 void readWithExternalReference() throws IOException {
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 void readWithXmlBomb() throws IOException {
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);
}

0 comments on commit 1a9cfef

Please sign in to comment.