### Question:
UserServiceImpl implements UserService { @Nonnull @Override public User getUserByUuId(@Nonnull final String uuId) { assertUserUuIdNotNull(uuId); logger.debug("Getting user for uuid - {}", uuId); final User user = userRepository.findByUuId(uuId).orElseThrow(() -> new UserNotFoundForUuidException(uuId)); logger.debug("Successfully retrieved user for uuid - {}, user - {}", uuId, user); return user; } UserServiceImpl(); @Nonnull @Override User getUserById(@Nonnull final Long id); @Transactional @Nonnull @Override User createUser(@Nonnull final UserDto userDto); @Nonnull @Override boolean checkIfUserExistsForUuId(@Nonnull final String uuId); @Nonnull @Override User getUserByUuId(@Nonnull final String uuId); @Transactional @Nonnull @Override User getOrCreateUserForUuId(final String uuId); UserRepository getUserRepository(); void setUserRepository(final UserRepository userRepository);  }### Answer:
@Test public void testGetUserByUuIdWithInvalidArguments() { resetAll(); replayAll(); try { userService.getUserByUuId(null); fail("Exception should be thrown"); } catch (final IllegalArgumentException ex) { } verifyAll(); }
@Test public void testGetUserByUuIdWithNotExistingUuId() { final String uuId = "KBLHOYUFOYTF^&FOYCCKTHLJ:"; resetAll(); expect(userRepository.findByUuId(eq(uuId))).andReturn(Optional.empty()).once(); replayAll(); try { userService.getUserByUuId(uuId); fail("Exception should be thrown"); } catch (final UserNotFoundForUuidException ex) { assertUserNotFoundForUuidException(ex, uuId); } verifyAll(); }
@Test public void testGetUserByUuId() { final String uuId = "KBLHOYUFOYTF^&FOYCCKTHLJ:"; final User user = getServicesImplTestHelper().createUser(); resetAll(); expect(userRepository.findByUuId(eq(uuId))).andReturn(Optional.of(user)).once(); replayAll(); final User result = userService.getUserByUuId(uuId); assertEquals(user, result); verifyAll(); }