vendredi 4 septembre 2020

Using spring WebTestClient to test if an endpoint is implemented or not

I have this test

@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = RANDOM_PORT)
@AutoConfigureWebTestClient
public class ITest {

    @Autowired
    private WebTestClient client1;


    @Test
    public void testGet() {
        client1.get().uri("/v1/resource/123" )
                .accept(MediaType.APPLICATION_JSON)
                .exchange()
                .expectStatus().isOk();
    }
}

Is there any way to test if the expectStatus() is "NOT_IMPLEMENTED" instead of isOk()

Aucun commentaire:

Enregistrer un commentaire