DeveloperService { public Developer find(Long id) { Developer developer = developerRepository.findOne(id); HeimdallException.checkThrow(developer == null, GLOBAL_RESOURCE_NOT_FOUND); return 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 findWithSuccessTest() { Mockito.when(developerRepository.findOne(developer.getId())).thenReturn(developer); Developer found = developerService.find(this.developer.getId()); assertEquals(developer, found); }
@Test public void findWithNotFound() { thrown.expect(NotFoundException.class); thrown.expectMessage("Resource not found"); Mockito.when(developerRepository.findOne(developer.getId())).thenReturn(null); developerService.find(developer.getId()); }