swaggerblueprint

Blueprint project
git clone git://git.wimdupont.com/swaggerblueprint.git
Log | Files | Refs | README | LICENSE

BlueprintControllerTest.java (1247B)


      1 package com.wimdupont.swagger.blueprint.controller;
      2 
      3 import com.wimdupont.swagger.blueprint.service.BlueprintService;
      4 import org.junit.jupiter.api.Test;
      5 import org.junit.jupiter.api.extension.ExtendWith;
      6 import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
      7 import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
      8 import org.springframework.boot.test.mock.mockito.MockBean;
      9 import org.springframework.http.MediaType;
     10 import org.springframework.test.context.junit.jupiter.SpringExtension;
     11 import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
     12 
     13 import static org.mockito.Mockito.verify;
     14 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
     15 
     16 @ExtendWith(SpringExtension.class)
     17 @WebMvcTest(BlueprintController.class)
     18 @AutoConfigureMockMvc
     19 class BlueprintControllerTest extends BaseMvcTest {
     20 
     21     @MockBean
     22     private BlueprintService blueprintService;
     23 
     24     @Test
     25     void getBlueprints() throws Exception {
     26         mvc.perform(MockMvcRequestBuilders.get("/blueprints")
     27                         .contentType(MediaType.APPLICATION_JSON))
     28                 .andExpectAll(status().isOk());
     29 
     30         verify(blueprintService).getBlueprints();
     31     }
     32 
     33 }