SPR-6785 - Improve message error when the MarshallingView modelKey attribute is not valid
This commit is contained in:
@@ -71,6 +71,29 @@ public class MarshallingViewTests {
|
||||
verify(marshallerMock);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void renderInvalidModelKey() throws Exception {
|
||||
Object toBeMarshalled = new Object();
|
||||
String modelKey = "key";
|
||||
view.setModelKey("invalidKey");
|
||||
Map model = new HashMap();
|
||||
model.put(modelKey, toBeMarshalled);
|
||||
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
|
||||
replay(marshallerMock);
|
||||
try {
|
||||
view.render(model, request, response);
|
||||
fail("ServletException expected");
|
||||
}
|
||||
catch (ServletException ex) {
|
||||
// expected
|
||||
}
|
||||
assertEquals("Invalid content length", 0, response.getContentLength());
|
||||
verify(marshallerMock);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void renderModelKeyUnsupported() throws Exception {
|
||||
Object toBeMarshalled = new Object();
|
||||
|
||||
Reference in New Issue
Block a user