Skip to content

Instantly share code, notes, and snippets.

@netodevel
Created December 30, 2016 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save netodevel/40f4c39c0be8edd4b6b5b8c86c9c1bc2 to your computer and use it in GitHub Desktop.
Save netodevel/40f4c39c0be8edd4b6b5b8c86c9c1bc2 to your computer and use it in GitHub Desktop.
package com.example;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
public class SalarioMinimoControllerTest extends DemoApplicationTests {
private MockMvc mockMvc;
@Autowired
private SalarioMinimoController salarioMinimoController;
@Before
public void setUp() {
this.mockMvc = MockMvcBuilders.standaloneSetup(salarioMinimoController).build();
}
@Test
public void testGETIndexSalarioMinimoController() throws Exception {
this.mockMvc.perform(MockMvcRequestBuilders.get("/salarios")).andExpect(MockMvcResultMatchers.status().isOk());
}
@Test
public void testGETSaveSalarioMinimoController() throws Exception {
this.mockMvc.perform(MockMvcRequestBuilders.get("/salarios/novo"))
.andExpect(MockMvcResultMatchers.model().attributeExists("salarioMinimo"))
.andExpect(MockMvcResultMatchers.status().isOk());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment