ResourceService { @Transactional(readOnly = true) public Resource find(Long apiId, Long resourceId) { Resource resource = resourceRepository.findByApiIdAndId(apiId, resourceId); HeimdallException.checkThrow(resource == null, GLOBAL_RESOURCE_NOT_FOUND); return resource; }  @Transactional(readOnly = true) Resource find(Long apiId, Long resourceId); ResourcePage list(Long apiId, ResourceDTO resourceDTO, PageableDTO pageableDTO); List<Resource> list(Long apiId, ResourceDTO resourceDTO); Resource save(Long apiId, ResourceDTO resourceDTO); Resource save(Long apiId, Resource resource); Resource update(Long apiId, Long resourceId, ResourceDTO resourceDTO); void delete(Long apiId, Long resourceId); void deleteAllFromApi(Long apiId);  }
@Test public void findResource() { Mockito.when(this.resourceRepository.findByApiIdAndId(Mockito.any(Long.class), Mockito.anyLong())) .thenReturn(resource); Resource resourceResp = resourceService.find(10L, 1L); assertEquals(resourceResp.getId(), resource.getId()); Mockito.verify(this.resourceRepository, Mockito.times(1)) .findByApiIdAndId(Mockito.any(Long.class), Mockito.anyLong()); }