### Question:
DistributedFilesPersistenceHandler implements LimboPersistenceHandler { @Override public LimboPlayer getLimboPlayer(Player player) { String uuid = PlayerUtils.getUuidOrName(player); File file = getPlayerSegmentFile(uuid); Map<String, LimboPlayer> entries = readLimboPlayers(file); return entries == null ? null : entries.get(uuid); } @Inject  DistributedFilesPersistenceHandler(@DataFolder File dataFolder, BukkitService bukkitService, Settings settings); @Override LimboPlayer getLimboPlayer(Player player); @Override void saveLimboPlayer(Player player, LimboPlayer limbo); @Override void removeLimboPlayer(Player player); @Override LimboPersistenceType getType();  }### Answer:
@Test public void shouldMigrateOldSegmentFilesOnStartup() { assertThat(playerDataFolder.list(), arrayContainingInAnyOrder("seg16-8-limbo.json", "seg16-f-limbo.json")); assertThat(persistenceHandler.getLimboPlayer(mockPlayerWithUuid(MIGRATED_UUID)), MIGRATED_LIMBO_MATCHER); assertThat(persistenceHandler.getLimboPlayer(mockPlayerWithUuid(UUID_FAB69)), FAB69_MATCHER); assertThat(persistenceHandler.getLimboPlayer(mockPlayerWithUuid(UUID_STAFF)), STAFF_MATCHER); assertThat(persistenceHandler.getLimboPlayer(mockPlayerWithUuid(UUID_8C679)), SC679_MATCHER); assertThat(persistenceHandler.getLimboPlayer(mockPlayerWithUuid(UNKNOWN_UUID)), nullValue()); assertThat(persistenceHandler.getLimboPlayer(mockPlayerWithUuid(UNKNOWN_UUID2)), nullValue()); }
@Test public void shouldHandleReadErrorGracefully() throws IOException { File invalidFile = new File(playerDataFolder, "seg16-4-limbo.json"); assertThat(invalidFile.exists(), equalTo(false)); Files.write("not valid json".getBytes(), invalidFile); LimboPlayer result = persistenceHandler.getLimboPlayer(mockPlayerWithUuid(UNKNOWN_UUID)); assertThat(result, nullValue()); }