@Test public void testSaveProvider() { Mockito.when(this.providerRepository.save(Mockito.any(Provider.class))).thenReturn(this.providerDatabase); Provider provider = this.providerService.save(this.providerDTO); assertNotNull(provider.getId()); Mockito.verify(this.providerRepository, Mockito.times(1)).save(Mockito.any(Provider.class)); }
public Provider save(ProviderDTO providerPersist) { Provider provider = GenericConverter.mapper(providerPersist, Provider.class); provider.setProviderDefault(false); provider.getProviderParams().forEach(p -> p.setProvider(provider)); return this.providerRepository.save(provider); }
ProviderService { public Provider save(ProviderDTO providerPersist) { Provider provider = GenericConverter.mapper(providerPersist, Provider.class); provider.setProviderDefault(false); provider.getProviderParams().forEach(p -> p.setProvider(provider)); return this.providerRepository.save(provider); } }
ProviderService { public Provider save(ProviderDTO providerPersist) { Provider provider = GenericConverter.mapper(providerPersist, Provider.class); provider.setProviderDefault(false); provider.getProviderParams().forEach(p -> p.setProvider(provider)); return this.providerRepository.save(provider); }  }
ProviderService { public Provider save(ProviderDTO providerPersist) { Provider provider = GenericConverter.mapper(providerPersist, Provider.class); provider.setProviderDefault(false); provider.getProviderParams().forEach(p -> p.setProvider(provider)); return this.providerRepository.save(provider); }  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); }
ProviderService { public Provider save(ProviderDTO providerPersist) { Provider provider = GenericConverter.mapper(providerPersist, Provider.class); provider.setProviderDefault(false); provider.getProviderParams().forEach(p -> p.setProvider(provider)); return this.providerRepository.save(provider); }  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);  }