title: JUnit 5 Unit Testing Get and Post methods
body: <p>I am new to spring boot and Junit testing. I am facing problem in testing Rest Api's Get and Post method. Many tutorials online guide about the use of mockMvc in JUnit testing. But are those still valid for JUnit 5. </p>
  
  <pre><code>@ExtendWith(SpringExtension.class)
  @WebMvcTest(controllers = RegisterRestController.class)
  class RegisterRestControllerTest {
    @Autowired
    private MockMvc mockMvc;
  
    @Autowired
    private ObjectMapper objectMapper;
  
    @MockBean
    private RegisterUseCase registerUseCase;
  
    @Test
    void whenValidInput_thenReturns200() throws Exception {
      mockMvc.perform(...);
    }
  
  }
  </code></pre>
  
  <p>However I read a article that you don't need to include @ExtendWith extension from SpringBoot 2.1 onwards.
  Since Junit 5 and spring boot both updated with lot of changes from previous version it has become difficult to analyse which code available online is correct regarding testing. 
  I am not able to use MockMvc.perform().andExpect(status().isOk()).</p>
  
  <pre><code>mockMvc.perform(post("/forums/{forumId}/register", 42L)
      .contentType("application/json")
      .param("sendWelcomeMail", "true")
      .content(objectMapper.writeValueAsString(user)))
      .andExpect(status().isOk());
  </code></pre>
  
  <p>What is the correct use of testing Get and post methods. And testing Rest verbs comes under unit testing or integration testing?</p>
  
  <p>Also guide me good source to check updated features of Junit 5 with Spring Boot(JUnit 5 doc is not helpful in my case).</p>