Last active
April 7, 2020 17:53
-
-
Save tasdemirbahadir/638dfdf41904cc10c59353e8300dcb15 to your computer and use it in GitHub Desktop.
Sample JUnit 5 test for quality measurement project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ExtendWith(SpringExtension.class) | |
@WebMvcTest(TestController.class) | |
class TestControllerTest { | |
@Autowired | |
private MockMvc mockMvc; | |
@Test | |
void it_should_get_test_message() throws Exception { | |
//Given | |
//When | |
var result = mockMvc.perform(get("/test")); | |
//Then | |
result.andExpect(status().isOk()) | |
.andExpect(jsonPath("$").value("Hello Sonar!")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment