Package org.springframework.test.web.servlet

Examples of org.springframework.test.web.servlet.ResultActions.andReturn()


    assertThat(xpath.evaluate("/feed/icon", doc), is("http://www.example.com/favicon.ico"));
  }

  private Document doGetForDocument(String path) throws Exception {
    ResultActions resultActions = mockMvc.perform(get(path));
    MvcResult mvcResult = resultActions.andReturn();
    return getAtomFeedDocument(mvcResult);
  }

  private Document getAtomFeedDocument(MvcResult mvcResult) throws ParserConfigurationException, SAXException, IOException {
    String atomFeed = mvcResult.getResponse().getContentAsString();
View Full Code Here


        return builder.parse(new ByteArrayInputStream(atomFeed.getBytes()));
    }

    private Document doGetForDocument(String path) throws Exception {
        ResultActions resultActions = mockMvc.perform(get(path));
        MvcResult mvcResult = resultActions.andReturn();
        return getAtomFeedDocument(mvcResult);
    }

    @Test
    public void feedHasCorrectMetadata() throws Exception {
View Full Code Here

 
  @Test
  public void testGettingPatient() throws Exception {
    ResultActions resultActions = this.mockMvc.perform(get("/patients/" + createdPatientId)
        .accept(MediaType.APPLICATION_JSON));
    LOG.debug("RestultActons: " + resultActions.andReturn().getResponse().getContentAsString()) ;
    resultActions.andExpect(status().isOk())
    .andExpect(content().string(containsString(String.valueOf(createdPatientId))));
 
 
  @Test
View Full Code Here

    Patient testPatientToInsert = this.createTestPatient();
    ResultActions resultActions = null;
    ApiResponse<Patient> retrievedPatient = null;
    try {
      resultActions = this.mockMvc.perform(post("/patients").content(convertObjectToBytes(testPatientToInsert)).contentType(MediaType.APPLICATION_JSON));
      LOG.debug("RestultActons: " + resultActions.andReturn().getResponse().getContentAsString()) ;
      resultActions.andExpect(status().isOk())
             .andExpect(content().string(notNullValue()));
     
    } finally {
      if (resultActions != null) {
View Full Code Here

      resultActions.andExpect(status().isOk())
             .andExpect(content().string(notNullValue()));
     
    } finally {
      if (resultActions != null) {
        retrievedPatient = this.jsonToObject(resultActions.andReturn().getResponse().getContentAsString());
        if (retrievedPatient != null && retrievedPatient.getPayload() != null){
          patientService.deletePatient(retrievedPatient.getPayload().getId());
        }
      }
    }
View Full Code Here

 
 
  @Test
  public void testGettingAllPatients() throws Exception {
    ResultActions resultActions = this.mockMvc.perform(get("/patients"));
    LOG.debug("RestultActons: " + resultActions.andReturn().getResponse().getContentAsString()) ;
    resultActions.andExpect(status().isOk())
            .andExpect(content().string(notNullValue()));
 
 
  @After
View Full Code Here

 
  @Test
  public void testGettingAllVisitFreqs() throws Exception {
    ResultActions resultActions = this.mockMvc.perform(get("/reporting/visitFrequency" )
        .accept(MediaType.APPLICATION_JSON));
    String result = resultActions.andReturn().getResponse().getContentAsString();
    LOG.debug("RestultActons: " + result) ;
   
    resultActions.andExpect(status().isOk());
    ApiResponse<List<VisitFrequency>> apiResponse = jsonToObject(result);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.