I test a Spring Data JPA method as shown below:
Optional<Country> findByUuid(final UUID uuid);
When I write Unit Test for this method, I can test it by using a return value of null or Optional.empty() in thenReturn() method.
when(demoRepository.findByUuid(uuid)).thenReturn(null);
// or
when(demoRepository.findByUuid(uuid)).thenReturn(Optional.empty());
So, which one is more proper way for this?