ProviderService { public Provider findOne(Long id) { return this.providerRepository.findOne(id); }  Provider save(ProviderDTO providerPersist); @Transactional Provider edit(Long idProvider, ProviderDTO providerEdit); ProviderPage listWithPageableAndFilter(ProviderDTO providerDTO, PageableDTO pageableDTO); List<Provider> listWithFilter(ProviderDTO providerDTO); Provider findOne(Long id); void delete(Long id);  }
@Test public void findProviderTest() { Provider provider = new Provider(); Mockito.when(this.providerRepository.findOne(Mockito.any(Long.class))).thenReturn(provider); Provider accessTokenResp = providerService.findOne(1L); assertEquals(accessTokenResp.getId(), provider.getId()); Mockito.verify(this.providerRepository, Mockito.times(1)).findOne(Mockito.any(Long.class)); }