Code example for MockMvc

Methods: perform

0
        Assert.assertTrue(locationUri.contains("/users/" + userId + "/customers/")); 
    } 
 
    @Test 
    public void testLoadingACustomerThatDoesNotExist() throws Exception { 
        this.mockMvc.perform(get("/users/" + 5 + "/customers/" + 24022) 
                .accept(this.applicationJsonMediaType)) 
                .andExpect(status().isNotFound()) 
                .andExpect(content().contentType(this.vndErrorMediaType)); 
 
    } 
 
    @Test 
    public void testLoadingAUserThatDoesNotExist() throws Exception { 
        this.mockMvc.perform(get("/users/" + 400) 
                .accept(this.applicationJsonMediaType)) 
                .andExpect(status().isNotFound()) 
                .andExpect(content().contentType(this.vndErrorMediaType)); 
 
    }