Code example for MockMvc

Methods: perform

0
    public void testGetProductById() throws Exception { 
    	//Arrange 
		Product product = new Product("P1234","iPhone 5s", new BigDecimal(500)); 
		 
		//Act & Assert 
		this.mockMvc.perform(get("/products/product") 
        					.param("id", "P1234")) 
            		.andExpect(model().attributeExists("product")) 
            		.andExpect(model().attribute("product", product)); 
    } 
 
}