Examples of andExpect()


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

    public void containsBlogPostFields() throws Exception {
        Post post = PostBuilder.post().category(PostCategory.ENGINEERING).isBroadcast().build();
        postRepository.save(post);

        ResultActions resultActions = mockMvc.perform(get("/blog.atom"));
        MvcResult mvcResult = resultActions
                .andExpect(status().isOk())
                .andExpect(content().contentTypeCompatibleWith("application/atom+xml"))
                .andReturn();

        assertThat(mvcResult.getResponse().getCharacterEncoding(), equalTo("utf-8"));
View Full Code Here

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

  @Test
  public void test() throws Exception {
    String id = "a/b";
    URI url = UriComponentsBuilder.fromUriString("/circuit").pathSegment(id).build().encode().toUri();
    ResultActions result = mockMvc.perform(get(url));
    result.andExpect(status().isOk()).andExpect(model().attribute("receivedId", is(id)));
  }


  @Configuration
  @EnableWebMvc
View Full Code Here

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

  @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
  public void testInsertingPatient() throws Exception {
View Full Code Here

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

    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) {
        retrievedPatient = this.jsonToObject(resultActions.andReturn().getResponse().getContentAsString());
View Full Code Here

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

 
  @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
  public void afterEach() {
View Full Code Here

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

    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);

    List<VisitFrequency> vfList = apiResponse.getPayload();
    int days = 0;
    for (VisitFrequency visitFrequency : vfList) {
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.