### Question:
PlayerServiceImpl implements PlayerService { @Override public Optional<Player> findWithUsername(String username) { Preconditions.checkNotNull(username, "username"); return playerDAO.findWithUsername(username); } @Inject  PlayerServiceImpl(UUIDFactory uuidFactory, PlayerDAO playerDAO, PlanetService planetService, PasswordService passwordService); @Override Player createPlayer(String username, String password); @Override Optional<Player> findWithUsername(String username);  }### Answer:
@Test public void testFindWithUsername() throws Exception { Player player = mock(Player.class); when(playerDAO.findWithUsername("Sheng Long")).thenReturn(Optional.of(player)); Optional<Player> actual = sut.findWithUsername("Sheng Long"); assertThat(actual, is(Optional.of(player))); }