コード例 #1
0
 @Test
 public void testSetTeamContext() throws Exception {
   String teamUid = "urn:va:foo:bar:baz";
   ModelAndView mav = controller.set("team", teamUid, mockRequest);
   verify(mockTeamContext).setCurrentTeamUid(teamUid);
   assertThat(mav.getViewName(), is(ContentNegotiatingViewResolver.DEFAULT_VIEW_NAME));
 }
コード例 #2
0
  @Test
  public void testSetMultipleContexts() throws Exception {
    String rosterUid = "urn:va:roster:foo";
    String boardUid = "urn:va:board:foo";
    String teamUid = "urn:va:team:foo";
    String encounterUid = "urn:va:encounter:foo";

    ModelAndView mav = controller.set(rosterUid, boardUid, teamUid, encounterUid, mockRequest);

    verify(mockRosterContext).setCurrentRosterUid(rosterUid);
    verify(mockBoardContext).setCurrentBoardUid(boardUid);
    verify(mockTeamContext).setCurrentTeamUid(teamUid);
    verify(mockEncounterContext).setCurrentEncounterUid(encounterUid);
    assertThat(mav.getViewName(), is(ContentNegotiatingViewResolver.DEFAULT_VIEW_NAME));
  }
コード例 #3
0
  @Test
  public void testSetPatientContext() throws Exception {
    String pid = "ABCD;1234";
    PatientSelect mockPatientSelect =
        new PatientSelect(Collections.<String, Object>singletonMap("pid", pid));
    when(mockPatientSelectDAO.findOneByPid(pid)).thenReturn(mockPatientSelect);
    PatientDemographics mockPatientDemographics =
        new PatientDemographics(Collections.<String, Object>singletonMap("pid", pid));
    when(mockPatientContext.getCurrentPatient()).thenReturn(mockPatientDemographics);

    ModelAndView mav = controller.set(pid, mockRequest);

    verify(mockPatientContext).setCurrentPatientPid(pid);
    assertThat(mav.getViewName(), is(ContentNegotiatingViewResolver.DEFAULT_VIEW_NAME));
    // TODO: test all extra patient context stuff included in model?
  }