@Test public void editDocumentWithParams2() throws DocumentNotFoundException { final DocumentReference documentReference = newDocumentReference("hello.txt") .withDocumentClass("test") .withIndex("name", "Wangler") .build(); when(documentService.findDocumentReference(1L)).thenReturn(documentReference); MockHttpServletRequest request = new MockHttpServletRequest(); request.setParameter("firstname", "Silvio"); final ModelAndView modelAndView = controller.editDocument(1L, request); assertThat(modelAndView.getViewName(), is("import.successful")); assertThat(modelAndView.getModel().size(), is(1)); assertThat(modelAndView.getModel().containsKey("doc"), is(true)); final DocumentReference doc = (DocumentReference) modelAndView.getModel().get("doc"); assertThat(doc, is(documentReference)); assertThat( doc.getIndices().get(new TranslatableKey("name")).getValue().toString(), is("Wangler")); InOrder order = inOrder(documentService); order.verify(documentService).findDocumentReference(1L); order.verify(documentService, never()).updateIndices(documentReference); order.verifyNoMoreInteractions(); }