ProviderService { public List<Provider> listWithFilter(ProviderDTO providerDTO) { Provider provider = GenericConverter.mapper(providerDTO, Provider.class); Example<Provider> example = Example.of(provider, ExampleMatcher.matching().withIgnorePaths("providerDefault").withIgnoreCase().withStringMatcher(StringMatcher.CONTAINING)); return this.providerRepository.findAll(example); }  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);  }
@SuppressWarnings("unchecked") @Test public void testListWithFilter() { List<Provider> listProviders = new ArrayList<>(); this.providerDatabase.setName("Provider Authentication"); listProviders.add(providerDatabase); Mockito.when(providerRepository.findAll(Mockito.any(Example.class))).thenReturn(listProviders); List<Provider> listProvidersResp = this.providerService.listWithFilter(providerDTO); assertEquals(listProviders.size(), listProvidersResp.size()); Mockito.verify(this.providerRepository, Mockito.times(1)).findAll(Mockito.any(Example.class)); }