### Question:
AuthMeApi { public Location getLastLocation(Player player) { PlayerAuth auth = playerCache.getAuth(player.getName()); if (auth != null) { return new Location(Bukkit.getWorld(auth.getWorld()), auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ(), auth.getYaw(), auth.getPitch()); } return null; } @Inject  AuthMeApi(AuthMe plugin, DataSource dataSource, PlayerCache playerCache, PasswordSecurity passwordSecurity,
              Management management, ValidationService validationService, GeoIpService geoIpService); static AuthMeApi getInstance(); AuthMe getPlugin(); String getPluginVersion(); boolean isAuthenticated(Player player); boolean isNpc(Player player); boolean isUnrestricted(Player player); Location getLastLocation(Player player); String getLastIp(String playerName); List<String> getNamesByIp(String address); @Deprecated Date getLastLogin(String playerName); Instant getLastLoginTime(String playerName); boolean isRegistered(String playerName); boolean checkPassword(String playerName, String passwordToCheck); boolean registerPlayer(String playerName, String password); void forceLogin(Player player); void forceLogout(Player player); void forceRegister(Player player, String password, boolean autoLogin); void forceRegister(Player player, String password); void forceUnregister(Player player); void forceUnregister(String name); void changePassword(String name, String newPassword); List<String> getRegisteredNames(); List<String> getRegisteredRealNames(); String getCountryCode(String ip); String getCountryName(String ip);  }### Answer:
@Test public void shouldGetLastLocation() { String name = "Gary"; Player player = mockPlayerWithName(name); PlayerAuth auth = PlayerAuth.builder().name(name) .locWorld("world") .locX(12.4) .locY(24.6) .locZ(-438.2) .locYaw(3.41f) .locPitch(0.29f) .build(); given(playerCache.getAuth(name)).willReturn(auth); Server server = mock(Server.class); ReflectionTestUtils.setField(Bukkit.class, null, "server", server); World world = mock(World.class); given(server.getWorld(auth.getWorld())).willReturn(world); Location result = api.getLastLocation(player); assertThat(result, not(nullValue())); assertThat(result.getX(), equalTo(auth.getQuitLocX())); assertThat(result.getY(), equalTo(auth.getQuitLocY())); assertThat(result.getZ(), equalTo(auth.getQuitLocZ())); assertThat(result.getWorld(), equalTo(world)); assertThat(result.getYaw(), equalTo(auth.getYaw())); assertThat(result.getPitch(), equalTo(auth.getPitch())); }
@Test public void shouldReturnNullForUnavailablePlayer() { String name = "Numan"; Player player = mockPlayerWithName(name); given(playerCache.getAuth(name)).willReturn(null); Location result = api.getLastLocation(player); assertThat(result, nullValue()); }