@Test public void deleteApiTest() { Mockito.when(apiRepository.findOne(Mockito.anyLong())).thenReturn(api); this.apiService.delete(1L); Mockito.verify(this.apiRepository, Mockito.times(1)).delete(api); }
public void delete(Long id) { Api api = apiRepository.findOne(id); HeimdallException.checkThrow(api == null, GLOBAL_RESOURCE_NOT_FOUND); resourceService.deleteAllFromApi(id); middlewareService.deleteAll(id); apiRepository.delete(api); amqpRoute.dispatchRoutes(); }
ApiService { public void delete(Long id) { Api api = apiRepository.findOne(id); HeimdallException.checkThrow(api == null, GLOBAL_RESOURCE_NOT_FOUND); resourceService.deleteAllFromApi(id); middlewareService.deleteAll(id); apiRepository.delete(api); amqpRoute.dispatchRoutes(); } }
ApiService { public void delete(Long id) { Api api = apiRepository.findOne(id); HeimdallException.checkThrow(api == null, GLOBAL_RESOURCE_NOT_FOUND); resourceService.deleteAllFromApi(id); middlewareService.deleteAll(id); apiRepository.delete(api); amqpRoute.dispatchRoutes(); }  }
ApiService { public void delete(Long id) { Api api = apiRepository.findOne(id); HeimdallException.checkThrow(api == null, GLOBAL_RESOURCE_NOT_FOUND); resourceService.deleteAllFromApi(id); middlewareService.deleteAll(id); apiRepository.delete(api); amqpRoute.dispatchRoutes(); }  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); }
ApiService { public void delete(Long id) { Api api = apiRepository.findOne(id); HeimdallException.checkThrow(api == null, GLOBAL_RESOURCE_NOT_FOUND); resourceService.deleteAllFromApi(id); middlewareService.deleteAll(id); apiRepository.delete(api); amqpRoute.dispatchRoutes(); }  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);  }