DeveloperService { @Transactional public void delete(Long id) { Developer developer = developerRepository.findOne(id); HeimdallException.checkThrow(developer == null, GLOBAL_RESOURCE_NOT_FOUND); developerRepository.delete(developer); }  Developer find(Long id); Developer login(DeveloperLogin developerLogin); DeveloperPage list(DeveloperDTO developerDTO, PageableDTO pageableDTO); List<Developer> list(DeveloperDTO developerDTO); @Transactional Developer save(DeveloperDTO developerDTO); @Transactional Developer update(Long id, DeveloperDTO developerDTO); @Transactional void delete(Long id);  }
@Test public void deleteWithSuccess() { Mockito.when(developerRepository.findOne(Mockito.anyLong())).thenReturn(developer); developerService.delete(developer.getId()); Mockito.verify(developerRepository, Mockito.times(1)).findOne(Mockito.anyLong()); }
@Test public void deleteWithDeveloperNotFound() { thrown.expect(NotFoundException.class); thrown.expectMessage("Resource not found"); Mockito.when(developerRepository.findOne(Mockito.anyLong())).thenReturn(null); developerService.delete(developer.getId()); }