use of com.faforever.client.domain.RatingHistoryDataPoint in project downlords-faf-client by FAForever.
the class UserInfoWindowControllerTest method setUp.
@Before
public void setUp() throws Exception {
instance = new UserInfoWindowController(statisticsService, countryFlagService, achievementService, eventService, i18n, uiService, timeService, notificationService, playerService, leaderboardService);
when(uiService.loadFxml("theme/achievement_item.fxml")).thenReturn(achievementItemController);
when(achievementItemController.getRoot()).thenReturn(new HBox());
when(playerService.getPlayersByIds(any())).thenReturn(CompletableFuture.completedFuture(Collections.emptyList()));
when(statisticsService.getRatingHistory(any(), eq(PLAYER_ID))).thenReturn(CompletableFuture.completedFuture(Arrays.asList(new RatingHistoryDataPoint(OffsetDateTime.now(), 1500f, 50f), new RatingHistoryDataPoint(OffsetDateTime.now().plus(1, ChronoUnit.DAYS), 1500f, 50f))));
loadFxml("theme/user_info_window.fxml", clazz -> instance);
}
use of com.faforever.client.domain.RatingHistoryDataPoint in project downlords-faf-client by FAForever.
the class UserInfoWindowController method ratingLabelFormatter.
@NotNull
private StringConverter<Number> ratingLabelFormatter(final List<RatingHistoryDataPoint> dataPoints) {
return new StringConverter<Number>() {
@Override
public String toString(Number object) {
int number = object.intValue();
int numberOfDataPoints = dataPoints.size();
int dataPointIndex = number >= numberOfDataPoints ? numberOfDataPoints - 1 : number;
if (dataPointIndex >= dataPoints.size() || dataPointIndex < 0) {
return "";
}
return DATE_FORMATTER.format(dataPoints.get(dataPointIndex).getInstant());
}
@Override
public Number fromString(String string) {
return null;
}
};
}
Aggregations