I have controller on groovy
@RestController
@RequestMapping('/v1')
@CompileStatic
class DatasourceResource {
private final DatasourceService datasourceService
@Autowired
DatasourceResource(final DatasourceService datasourceService) {
this.datasourceService = datasourceService
}
@Secured(hasAuthority = 'RADAR_LITE_SERVICE_DATA_ACCESS')
@GetMapping(value = '`/datasources/types', headers = 'token', produces = MediaType.APPLICATION_JSON_VALUE)
Response<List<String>> getDatabaseType() {
return new Response(DatabaseType.values()*.toString())
}
}
I wrote simple test on java
@RunWith(SpringRunner.class)
@WebMvcTest(DatasourceResource.class)
public class DatasourceResourceTest {
@MockBean
private DatasourceService datasourceService;
@Autowired
private MockMvc mockMvc;
@Test
public void getDatabaseType() throws Exception {
mockMvc.perform(post("/v1/datasources/types"))
.andExpect(status().isOk());
}
}
But when i run test, it stucking on 'instantiate tests' step in IDEA. Test task just stucking even when i start this task from terminal. And its stucks only on it test, if i remove @WebMvcTest annotation and mockMvc field and test body it will not stuck, and will passed. Looks like spring cant start context or tomcat. How can i check this or fix?
We using SpringBoot 2.1.0.RELEASE