EnvironmentService { public Environment find(Long id) { Environment environment = environmentRepository.findOne(id); HeimdallException.checkThrow(environment == null, GLOBAL_RESOURCE_NOT_FOUND); return environment; }  Environment find(Long id); EnvironmentPage list(EnvironmentDTO environmentDTO, PageableDTO pageableDTO); List<Environment> list(EnvironmentDTO environmentDTO); @Transactional Environment save(EnvironmentDTO environmentDTO); @Transactional Environment update(Long id, EnvironmentDTO environmentDTO); @Transactional void delete(Long id);  }
@Test public void findEnvironment() { Mockito.when(this.environmentRepository.findOne(Mockito.any(Long.class))).thenReturn(environment); Environment environmentResp = environmentService.find(1L); assertEquals(environmentResp.getId(), environment.getId()); Mockito.verify(this.environmentRepository, Mockito.times(1)).findOne(Mockito.any(Long.class)); }