List of usage examples for org.springframework.web.servlet ModelAndView getViewName
@Nullable
public String getViewName()
From source file:org.openmrs.module.radiology.web.controller.RadiologyObsFormControllerTest.java
/** * @see RadiologyObsFormController#voidObs(HttpServletRequest,HttpServletResponse,RadiologyOrder,Obs,String) * @verifies not void obs with empty voiding reason *//*w ww.j a v a 2s.c om*/ @Test public void voidObs_shouldNotVoidObsWithEmptyVoidingReason() throws Exception { //given mockRequest.addParameter("voidObs", "voidObs"); ModelAndView modelAndView = radiologyObsFormController.voidObs(mockRequest, null, mockRadiologyOrder, mockObs, ""); assertThat(mockSession.getAttribute(WebConstants.OPENMRS_MSG_ATTR), is(nullValue())); assertThat(modelAndView.getViewName(), is("module/radiology/radiologyObsForm")); }
From source file:org.openmrs.module.radiology.web.controller.RadiologyObsFormControllerTest.java
/** * @see RadiologyObsFormController#voidObs(HttpServletRequest,HttpServletResponse,RadiologyOrder,Obs,String) * @verifies not void obs with voiding reason null *///w w w. j av a 2 s .co m @Test public void voidObs_shouldNotVoidObsWithVoidingReasonNull() throws Exception { //given mockRequest.addParameter("voidObs", "voidObs"); ModelAndView modelAndView = radiologyObsFormController.voidObs(mockRequest, null, mockRadiologyOrder, mockObs, null); assertThat(mockSession.getAttribute(WebConstants.OPENMRS_MSG_ATTR), is(nullValue())); assertThat(modelAndView.getViewName(), is("module/radiology/radiologyObsForm")); }
From source file:com.thoughtworks.go.server.controller.ArtifactsControllerIntegrationTest.java
@Test public void shouldHaveJobIdentifierInModelForHtmlFolderView() throws Exception { ModelAndView mav = artifactsController.getArtifactAsHtml(pipeline.getName(), pipeline.getLabel(), stage.getName(), String.valueOf(stage.getCounter()), job.getName(), "", null, null); assertThat(mav.getModel().get("jobIdentifier"), is(new JobIdentifier(pipeline, stage, job))); assertThat(mav.getViewName(), is("rest/html")); }
From source file:org.openmrs.module.radiology.web.controller.RadiologyObsFormControllerTest.java
/** * @see RadiologyObsFormController#saveComplexObs(MultipartHttpServletRequest,HttpServletResponse,String,RadiologyOrder,Obs,BindingResult) * @verifies return populated model and view for invalid complex obs *//*from w w w .ja va 2 s .c o m*/ @Test public void saveComplexObs_shouldReturnPopulatedModelAndViewForInvalidComplexObs() throws Exception { when(obsErrors.hasErrors()).thenReturn(true); when(obsService.saveObs(mockObs, "Test Edit Reason")).thenReturn(RadiologyTestData.getEditedMockObs()); ModelAndView modelAndView = radiologyObsFormController.saveComplexObs( mockMultipartHttpServletRequestRequest, null, "Test Edit Reason", mockRadiologyOrder, mockObs, obsErrors); assertThat(modelAndView, is(notNullValue())); assertThat(modelAndView.getViewName(), is("module/radiology/radiologyObsForm")); assertThat(modelAndView.getModelMap(), hasKey("obs")); Obs obs = (Obs) modelAndView.getModelMap().get("obs"); assertThat(obs, is(mockObs)); }
From source file:org.openmrs.module.radiology.web.controller.RadiologyObsFormControllerTest.java
/** * @see RadiologyObsFormController#saveObs(HttpServletRequest,HttpServletResponse,String,RadiologyOrder,Obs,BindingResult) * @verifies populate model and view with obs for occuring Exception *///w w w .j a v a 2 s . com @Test public void saveObs_shouldPopulateModelAndViewWithObsForOccuringException() throws Exception { //given mockRequest.addParameter("saveObs", "saveObs"); APIException apiException = new APIException("Test Exception Handling"); when(obsService.saveObs(mockObs, "Test Edit Reason")).thenThrow(apiException); ModelAndView modelAndView = radiologyObsFormController.saveObs(mockRequest, null, "Test Edit Reason", mockRadiologyOrder, mockObs, obsErrors); assertThat((String) mockSession.getAttribute(WebConstants.OPENMRS_ERROR_ATTR), is("Test Exception Handling")); assertThat(modelAndView.getViewName(), is("module/radiology/radiologyObsForm")); assertThat(modelAndView, is(notNullValue())); assertThat(modelAndView.getModelMap(), hasKey("obs")); Obs obs = (Obs) modelAndView.getModelMap().get("obs"); assertThat(obs, is(mockObs)); }
From source file:com.formkiq.core.service.workflow.WorkflowServiceImplTest.java
/** * print action.//from w w w .j a va2 s . com * @throws IOException IOException */ @Test public void testActions01() throws IOException { // given MockHttpServletResponse resp = new MockHttpServletResponse(); expectStart(this.form).getRight(); resetAll(); this.req.setParameter("execution", "s1e1"); this.req.setParameter("_eventId_print", ""); // when replayAll(); ModelAndView result = this.ws.actions(this.req, resp); // then verifyAll(); assertEquals("flow/print", result.getViewName()); }
From source file:com.formkiq.core.service.workflow.WorkflowServiceImplTest.java
/** * testState01// w ww . j ava 2 s . c om * Gets the current state of FSM. * @throws Exception Exception */ @Test public void testState01() throws Exception { // given testStart01(); resetAll(); // when replayAll(); ModelAndView result = this.ws.state(this.req).getLeft(); // then verifyAll(); assertEquals("flow/workflow", result.getViewName()); assertNotNull(result.getModel().get("flow")); }
From source file:com.formkiq.core.service.workflow.WorkflowServiceImplTest.java
/** * testState02.//from ww w . j av a2 s.com * redirects to correct page, if EventId is wrong * @throws Exception Exception */ @Test public void testState02() throws Exception { // given testStart01(); resetAll(); this.req.setParameter("execution", "s1e10"); // when replayAll(); ModelAndView result = this.ws.state(this.req).getLeft(); // then verifyAll(); assertEquals("redirect:/flow/workflow?execution=s1e1", result.getViewName()); }
From source file:com.formkiq.core.service.workflow.WorkflowServiceImplTest.java
/** * testTransition02().// ww w . ja va 2 s. com * transition to PREVIOUS * @throws Exception Exception */ @Test public void testTransition02() throws Exception { // given testTransition01(); resetAll(); this.req.removeParameter("_eventId_next"); this.req.addParameter("_eventId_prev", ""); // when replayAll(); ModelAndView result = this.ws.transition(this.req).getLeft(); // then verifyAll(); assertEquals("redirect:/flow/workflow?execution=s1e1", result.getViewName()); }
From source file:com.formkiq.core.service.workflow.WorkflowServiceImplTest.java
/** * testTransition03().//from w w w . j ava 2 s.c om * missing transition but HAS execution parameter * @throws Exception Exception */ @Test public void testTransition03() throws Exception { // given testTransition01(); resetAll(); this.req.removeParameter("_eventId_next"); this.req.removeParameter("_eventId_prev"); // when replayAll(); ModelAndView result = this.ws.transition(this.req).getLeft(); // then verifyAll(); assertEquals("redirect:/flow/workflow?execution=s1e1", result.getViewName()); }