use of com.djrapitops.plan.delivery.domain.keys.PlayerKeys in project Plan by plan-player-analytics.
the class DatabaseTest method playerContainerSupportsAllPlayerKeys.
@Test
default void playerContainerSupportsAllPlayerKeys() throws IllegalAccessException {
saveUserOne();
saveUserTwo();
saveTwoWorlds();
FinishedSession session = RandomData.randomSession(serverUUID(), worlds, playerUUID, player2UUID);
execute(DataStoreQueries.storeSession(session));
db().executeTransaction(new NicknameStoreTransaction(playerUUID, RandomData.randomNickname(serverUUID()), (uuid, name) -> false));
saveGeoInfo(playerUUID, new GeoInfo("TestLoc", RandomData.randomTime()));
assertTrue(db().query(PlayerFetchQueries.isPlayerRegistered(playerUUID)));
db().executeTransaction(new PingStoreTransaction(playerUUID, serverUUID(), RandomData.randomIntDateObjects()));
PlayerContainer playerContainer = db().query(ContainerFetchQueries.fetchPlayerContainer(playerUUID));
// Active sessions are added after fetching
playerContainer.putRawData(PlayerKeys.ACTIVE_SESSION, RandomData.randomUnfinishedSession(serverUUID(), worlds, playerUUID));
List<String> unsupported = new ArrayList<>();
List<Key> keys = FieldFetcher.getPublicStaticFields(PlayerKeys.class, Key.class);
for (Key<?> key : keys) {
if (!playerContainer.supports(key)) {
unsupported.add(key.getKeyName());
}
}
assertTrue(unsupported.isEmpty(), () -> "Some keys are not supported by PlayerContainer: PlayerKeys." + unsupported.toString());
}
Aggregations