Java Testing 10/20 - Testare Controller REST con Spring Boot, @WebMvcTest e MockMvc

Giovanni Pace

Descrizione

Iniziamo a testare i Controller REST di Spring Boot: ti mostro cos'è @WebMvcTest, come usare MockMvc per simulare chiamate HTTP nei test e verificare le response senza avviare l'intero contesto applicativo.

Iniziamo a testare un Controller REST in Spring Boot. Vediamo: - Cos'è @WebMvcTest - Come usare MockMvc - Simulare chiamate HTTP nei test Portiamo il testing nel mondo reale.