use of com.faforever.client.api.dto.PlayerAchievement in project downlords-faf-client by FAForever.
the class AchievementItemControllerTest method testSetPlayerAchievementUnlocked.
@Test
public void testSetPlayerAchievementUnlocked() throws Exception {
instance.setAchievementDefinition(AchievementDefinitionBuilder.create().defaultValues().get());
PlayerAchievement playerAchievement = PlayerAchievementBuilder.create().defaultValues().state(com.faforever.client.api.dto.AchievementState.UNLOCKED).currentSteps(50).get();
instance.setPlayerAchievement(playerAchievement);
assertThat(instance.imageView.getEffect(), is(nullValue()));
assertThat(instance.imageView.getOpacity(), is(1.0));
assertThat(instance.progressBar.isVisible(), is(true));
assertThat(instance.progressBar.getProgress(), is(0.5));
}
use of com.faforever.client.api.dto.PlayerAchievement in project downlords-faf-client by FAForever.
the class FafApiAccessorImplTest method testGetPlayerAchievements.
@Test
@SuppressWarnings("unchecked")
public void testGetPlayerAchievements() {
PlayerAchievement playerAchievement1 = new PlayerAchievement();
playerAchievement1.setId("1");
playerAchievement1.setAchievement(new AchievementDefinition().setId("1-2-3"));
PlayerAchievement playerAchievement2 = new PlayerAchievement();
playerAchievement2.setId("2");
playerAchievement2.setAchievement(new AchievementDefinition().setId("2-3-4"));
List<PlayerAchievement> result = Arrays.asList(playerAchievement1, playerAchievement2);
when(restOperations.getForObject(anyString(), eq(List.class))).thenReturn(result).thenReturn(emptyList());
assertThat(instance.getPlayerAchievements(123), is(result));
verify(restOperations).getForObject("/data/playerAchievement?filter=player.id==\"123\"&page[size]=10000&page[number]=1", List.class);
}
use of com.faforever.client.api.dto.PlayerAchievement in project downlords-faf-client by FAForever.
the class AchievementServiceImplTest method testGetPlayerAchievementsForAnotherUser.
@Test
public void testGetPlayerAchievementsForAnotherUser() throws Exception {
List<PlayerAchievement> achievements = Arrays.asList(new PlayerAchievement(), new PlayerAchievement());
when(fafService.getPlayerAchievements(PLAYER_ID)).thenReturn(CompletableFuture.completedFuture(achievements));
List<PlayerAchievement> playerAchievements = instance.getPlayerAchievements(PLAYER_ID).toCompletableFuture().get(5, TimeUnit.SECONDS);
assertThat(playerAchievements, hasSize(2));
assertThat(playerAchievements, is(achievements));
verify(fafService).getPlayerAchievements(PLAYER_ID);
}
Aggregations