ApiService { public Api find(Long id) { Api api = apiRepository.findOne(id); HeimdallException.checkThrow(api == null, GLOBAL_RESOURCE_NOT_FOUND); return api; }  Api find(Long id); Swagger findSwaggerByApi(Long id); ApiPage list(ApiDTO apiDTO, PageableDTO pageableDTO); List<Api> list(ApiDTO apiDTO); Api save(ApiDTO apiDTO); Api update(Long id, ApiDTO apiDTO); Api updateBySwagger(Long id, String swagger, boolean override); void delete(Long id); @Transactional(readOnly = true) List<Plan> plansByApi(Long id);  }
@Test public void findApiTest() { Mockito.when(this.apiRepository.findOne(Mockito.any(Long.class))).thenReturn(api); Api apiResp = apiService.find(1L); assertEquals(apiResp.getId(), api.getId()); Mockito.verify(this.apiRepository, Mockito.times(1)).findOne(Mockito.any(Long.class)); }