I finded this code to test is a json is equal to a string
@RunWith(SpringRunner.class)
@SpringBootTest
@AutoConfigureMockMvc
public class MockMvcExampleTests {
@Autowired
private MockMvc mvc;
@Test
public void exampleTest() throws Exception {
this.mvc.perform(get("/")).andExpect(status().isOk())
.andExpect(content().string("Hello World"));
}
}
Do you know how to test the json structure ? Like check if the object contains id, name, age ... whatever the values are Thanks
Aucun commentaire:
Enregistrer un commentaire