### Question:
LeaveRequestService { public Optional<LeaveRequest> approve(UUID id) { Optional<LeaveRequest> found = repo.findById(id); found.ifPresent(lr -> lr.setStatus(Status.APPROVED)); return found; }  LeaveRequest request(String employee, LocalDate from, LocalDate to); Optional<LeaveRequest> approve(UUID id); Optional<LeaveRequest> deny(UUID id); Optional<LeaveRequest> retrieve(UUID id); List<LeaveRequest> retrieveFor(String employee); List<LeaveRequest> retrieveAll();  }### Answer:
@Test void testApprove() { LeaveRequest saved = repository.save(new LeaveRequest("Alice", of(2019, 11, 30), of(2019, 12, 03), PENDING)); Optional<LeaveRequest> approved = service.approve(saved.getId()); verify(repository).findById(saved.getId()); assertThat(approved).isPresent(); assertThat(approved).get().isSameAs(saved); assertThat(approved.get().getStatus()).isSameAs(APPROVED); }