use of com.faforever.client.mod.FeaturedMod in project downlords-faf-client by FAForever.
the class CreateGameControllerTest method testSelectLastOrDefaultSelectLast.
@Test
public void testSelectLastOrDefaultSelectLast() {
FeaturedMod featuredMod = FeaturedModBeanBuilder.create().defaultValues().technicalName("last").get();
FeaturedMod featuredMod2 = FeaturedModBeanBuilder.create().defaultValues().technicalName(KnownFeaturedMod.DEFAULT.getTechnicalName()).get();
preferences.setLastGameType("last");
when(modService.getFeaturedMods()).thenReturn(completedFuture(asList(featuredMod, featuredMod2)));
WaitForAsyncUtils.asyncFx(() -> instance.initialize());
WaitForAsyncUtils.waitForFxEvents();
assertThat(instance.featuredModListView.getSelectionModel().getSelectedItem(), is(featuredMod));
}
use of com.faforever.client.mod.FeaturedMod in project downlords-faf-client by FAForever.
the class CreateGameControllerTest method testInitGameTypeComboBoxPostPopulated.
@Test
public void testInitGameTypeComboBoxPostPopulated() {
FeaturedMod featuredMod = FeaturedModBeanBuilder.create().defaultValues().get();
when(modService.getFeaturedMods()).thenReturn(completedFuture(singletonList(featuredMod)));
WaitForAsyncUtils.asyncFx(() -> instance.initialize());
WaitForAsyncUtils.waitForFxEvents();
assertThat(instance.featuredModListView.getItems(), hasSize(1));
assertThat(instance.featuredModListView.getItems().get(0), is(featuredMod));
}
use of com.faforever.client.mod.FeaturedMod in project downlords-faf-client by FAForever.
the class ReplayDetailControllerTest method onDownloadMoreInfoClicked.
@Test
public void onDownloadMoreInfoClicked() throws Exception {
when(replayService.getSize(anyInt())).thenReturn(CompletableFuture.completedFuture(1024));
Replay replay = new Replay();
Review review = new Review();
review.setPlayer(new Player("junit"));
replay.getReviews().setAll(FXCollections.observableArrayList(review));
replay.setValidity(Validity.VALID);
replay.setFeaturedMod(new FeaturedMod());
instance.setReplay(replay);
Path tmpPath = Paths.get("foo.tmp");
when(replayService.downloadReplay(replay.getId())).thenReturn(CompletableFuture.completedFuture(tmpPath));
instance.onDownloadMoreInfoClicked();
verify(replayService).enrich(replay, tmpPath);
assertThat(instance.optionsTable.isVisible(), is(true));
assertThat(instance.chatTable.isVisible(), is(true));
}
use of com.faforever.client.mod.FeaturedMod in project downlords-faf-client by FAForever.
the class CreateGameControllerTest method testSelectLastOrDefaultSelectDefault.
@Test
public void testSelectLastOrDefaultSelectDefault() {
FeaturedMod featuredMod = FeaturedModBeanBuilder.create().defaultValues().technicalName("something").get();
FeaturedMod featuredMod2 = FeaturedModBeanBuilder.create().defaultValues().technicalName(KnownFeaturedMod.DEFAULT.getTechnicalName()).get();
preferences.setLastGameType(null);
when(modService.getFeaturedMods()).thenReturn(completedFuture(asList(featuredMod, featuredMod2)));
WaitForAsyncUtils.asyncFx(() -> instance.initialize());
WaitForAsyncUtils.waitForFxEvents();
assertThat(instance.featuredModListView.getSelectionModel().getSelectedItem(), is(featuredMod2));
}
use of com.faforever.client.mod.FeaturedMod in project downlords-faf-client by FAForever.
the class GameServiceImplTest method testStartSearchLadder1v1.
@Test
public void testStartSearchLadder1v1() throws Exception {
GameLaunchMessage gameLaunchMessage = new GameLaunchMessage();
gameLaunchMessage.setMod("ladder1v1");
gameLaunchMessage.setUid(123);
gameLaunchMessage.setArgs(emptyList());
gameLaunchMessage.setMapname("scmp_037");
FeaturedMod featuredMod = FeaturedModBeanBuilder.create().defaultValues().get();
when(fafService.startSearchLadder1v1(CYBRAN, GAME_PORT)).thenReturn(CompletableFuture.completedFuture(gameLaunchMessage));
when(gameUpdater.update(featuredMod, null, Collections.emptyMap(), Collections.emptySet())).thenReturn(CompletableFuture.completedFuture(null));
when(mapService.isInstalled("scmp_037")).thenReturn(false);
when(mapService.download("scmp_037")).thenReturn(CompletableFuture.completedFuture(null));
when(modService.getFeaturedMod(LADDER_1V1.getTechnicalName())).thenReturn(CompletableFuture.completedFuture(featuredMod));
CompletableFuture<Void> future = instance.startSearchLadder1v1(CYBRAN).toCompletableFuture();
verify(fafService).startSearchLadder1v1(CYBRAN, GAME_PORT);
verify(mapService).download("scmp_037");
verify(replayService).startReplayServer(123);
verify(forgedAllianceService, timeout(100)).startGame(eq(123), eq(CYBRAN), eq(asList("/team", "1", "/players", "2")), eq(RatingMode.LADDER_1V1), anyInt(), eq(LOCAL_REPLAY_PORT), eq(false), eq(junitPlayer));
assertThat(future.get(TIMEOUT, TIME_UNIT), is(nullValue()));
}
Aggregations