HttpMessageNotReadableException provides access to HttpInputMessage
Issue: SPR-15588
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 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.
|
||||
@@ -87,7 +87,7 @@ public class MarshallingHttpMessageConverterTests {
|
||||
assertEquals("Invalid result", body, result);
|
||||
}
|
||||
|
||||
@Test(expected = TypeMismatchException.class)
|
||||
@Test
|
||||
public void readWithTypeMismatchException() throws Exception {
|
||||
MockHttpInputMessage inputMessage = new MockHttpInputMessage(new byte[0]);
|
||||
|
||||
@@ -96,7 +96,13 @@ public class MarshallingHttpMessageConverterTests {
|
||||
given(unmarshaller.unmarshal(isA(StreamSource.class))).willReturn(Integer.valueOf(3));
|
||||
|
||||
MarshallingHttpMessageConverter converter = new MarshallingHttpMessageConverter(marshaller, unmarshaller);
|
||||
converter.read(String.class, inputMessage);
|
||||
try {
|
||||
converter.read(String.class, inputMessage);
|
||||
fail("Should have thrown HttpMessageNotReadableException");
|
||||
}
|
||||
catch (HttpMessageNotReadableException ex) {
|
||||
assertTrue(ex.getCause() instanceof TypeMismatchException);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user