### Question:
LimboService { public void replaceTasksAfterRegistration(Player player) { Optional<LimboPlayer> limboPlayer = getLimboOrLogError(player, "reset tasks"); limboPlayer.ifPresent(limbo -> { taskManager.registerTimeoutTask(player, limbo); taskManager.registerMessageTask(player, limbo, true); }); authGroupHandler.setGroup(player, limboPlayer.orElse(null), AuthGroupType.REGISTERED_UNAUTHENTICATED); } LimboService(); void createLimboPlayer(Player player, boolean isRegistered); LimboPlayer getLimboPlayer(String name); boolean hasLimboPlayer(String name); void restoreData(Player player); void replaceTasksAfterRegistration(Player player); void resetMessageTask(Player player, boolean isRegistered); void muteMessageTask(Player player); void unmuteMessageTask(Player player);  }### Answer:
@Test public void shouldHandleMissingLimboForReplaceTasks() { Player player = newPlayer("ghost"); limboService.replaceTasksAfterRegistration(player); verifyZeroInteractions(taskManager); verify(authGroupHandler).setGroup(player, null, AuthGroupType.REGISTERED_UNAUTHENTICATED); }
@Test public void shouldReplaceTasks() { LimboPlayer limbo = mock(LimboPlayer.class); getLimboMap().put("jeff", limbo); Player player = newPlayer("JEFF"); limboService.replaceTasksAfterRegistration(player); verify(taskManager).registerTimeoutTask(player, limbo); verify(taskManager).registerMessageTask(player, limbo, true); verify(authGroupHandler).setGroup(player, limbo, AuthGroupType.REGISTERED_UNAUTHENTICATED); }