### Question:
IndividualFilesPersistenceHandler implements LimboPersistenceHandler { @Override public LimboPlayer getLimboPlayer(Player player) { String id = PlayerUtils.getUuidOrName(player); File file = new File(cacheDir, id + File.separator + "data.json"); if (!file.exists()) { return null; } try { String str = Files.asCharSource(file, StandardCharsets.UTF_8).read(); return gson.fromJson(str, LimboPlayer.class); } catch (IOException e) { ConsoleLogger.logException("Could not read player data on disk for '" + player.getName() + "'", e); return null; } } @Inject  IndividualFilesPersistenceHandler(@DataFolder File dataFolder, BukkitService bukkitService); @Override LimboPlayer getLimboPlayer(Player player); @Override void saveLimboPlayer(Player player, LimboPlayer limboPlayer); @Override void removeLimboPlayer(Player player); @Override LimboPersistenceType getType();  }### Answer:
@Test public void shouldReadDataFromFile() { Player player = mock(Player.class); given(player.getUniqueId()).willReturn(SAMPLE_UUID); World world = mock(World.class); given(bukkitService.getWorld("nether")).willReturn(world); LimboPlayer data = handler.getLimboPlayer(player); assertThat(data, not(nullValue())); assertThat(data.isOperator(), equalTo(true)); assertThat(data.isCanFly(), equalTo(true)); assertThat(data.getWalkSpeed(), equalTo(0.2f)); assertThat(data.getFlySpeed(), equalTo(0.1f)); assertThat(data.getGroups(), contains("players")); Location location = data.getLocation(); assertThat(location.getX(), equalTo(-113.219)); assertThat(location.getY(), equalTo(72.0)); assertThat(location.getZ(), equalTo(130.637)); assertThat(location.getWorld(), equalTo(world)); assertThat(location.getPitch(), equalTo(24.15f)); assertThat(location.getYaw(), equalTo(-292.484f)); }
@Test public void shouldReturnNullForUnavailablePlayer() { Player player = mock(Player.class); given(player.getUniqueId()).willReturn(UUID.nameUUIDFromBytes("other-player".getBytes())); LimboPlayer data = handler.getLimboPlayer(player); assertThat(data, nullValue()); }