use of com.faforever.client.preferences.Preferences in project downlords-faf-client by FAForever.
the class FaInitGeneratorTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
instance = new FaInitGenerator(preferencesService);
Preferences preferences = new Preferences();
preferences.getForgedAlliance().setPath(faDirectory.getRoot().toPath());
when(preferencesService.getFafBinDirectory()).thenReturn(fafBinDirectory.getRoot().toPath());
when(preferencesService.getPreferences()).thenReturn(preferences);
}
use of com.faforever.client.preferences.Preferences in project downlords-faf-client by FAForever.
the class GameServiceImplTest method setUp.
@Before
public void setUp() throws Exception {
junitPlayer = PlayerBuilder.create("JUnit").defaultValues().get();
ClientProperties clientProperties = new ClientProperties();
clientProperties.getReplay().setLocalServerPort(LOCAL_REPLAY_PORT);
instance = new GameServiceImpl(clientProperties, fafService, forgedAllianceService, mapService, preferencesService, gameUpdater, notificationService, i18n, executor, playerService, reportingService, eventBus, iceAdapter, modService, platformService, externalReplayInfoGenerator);
instance.replayService = replayService;
Preferences preferences = new Preferences();
preferences.getForgedAlliance().setPort(GAME_PORT);
when(preferencesService.getPreferences()).thenReturn(preferences);
when(fafService.connectionStateProperty()).thenReturn(new SimpleObjectProperty<>());
when(replayService.startReplayServer(anyInt())).thenReturn(CompletableFuture.completedFuture(null));
when(iceAdapter.start()).thenReturn(CompletableFuture.completedFuture(GPG_PORT));
when(playerService.getCurrentPlayer()).thenReturn(Optional.of(junitPlayer));
doAnswer(invocation -> {
try {
((Runnable) invocation.getArgument(0)).run();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}).when(executor).execute(any());
instance.postConstruct();
verify(fafService).addOnMessageListener(eq(GameInfoMessage.class), gameInfoMessageListenerCaptor.capture());
}
use of com.faforever.client.preferences.Preferences in project downlords-faf-client by FAForever.
the class AbstractChatTabControllerTest method start.
@Override
public void start(Stage stage) throws Exception {
super.start(stage);
preferences = new Preferences();
Clan clan = new Clan();
clan.setId("1234");
Vault vault = new Vault();
vault.setReplayDownloadUrlFormat(TEST_REPLAY_BASE_URL);
when(replayService.findById(any(Integer.class))).thenReturn(completedFuture(Optional.of(new Replay())));
when(clanService.getClanByTag(sampleClanTag)).thenReturn(completedFuture(Optional.of(clan)));
when(uiService.loadFxml("theme/chat/clan_tooltip.fxml")).thenReturn(mock(ClanTooltipController.class));
when(uiService.getThemeFileUrl(any())).thenReturn(getClass().getResource("/theme/chat/chat_section.html"));
when(timeService.asShortTime(any())).thenReturn("123");
when(userService.getUsername()).thenReturn("junit");
when(preferencesService.getPreferences()).thenReturn(preferences);
when(clientProperties.getVault()).thenReturn(vault);
instance = new AbstractChatTabController(clanService, webViewConfigurer, userService, chatService, platformService, preferencesService, playerService, audioService, timeService, i18n, imageUploadService, urlPreviewResolver, notificationService, reportingService, uiService, autoCompletionHelper, eventBus, countryFlagService, replayService, clientProperties, externalReplayInfoGenerator) {
private final Tab root = new Tab();
private final WebView webView = new WebView();
private final TextInputControl messageTextField = new TextField();
@Override
public Tab getRoot() {
return root;
}
@Override
protected TextInputControl messageTextField() {
return messageTextField;
}
@Override
protected WebView getMessagesWebView() {
return webView;
}
};
TabPane tabPane = new TabPane(instance.getRoot());
getRoot().getChildren().setAll(tabPane);
chatReadyLatch = new CountDownLatch(1);
instance.getMessagesWebView().getEngine().getLoadWorker().stateProperty().addListener((observable, oldValue, newValue) -> {
if (Worker.State.SUCCEEDED.equals(newValue)) {
chatReadyLatch.countDown();
}
});
instance.initialize();
}
use of com.faforever.client.preferences.Preferences in project downlords-faf-client by FAForever.
the class SettingsControllerTest method setUp.
@Before
public void setUp() throws Exception {
preferences = new Preferences();
when(preferenceService.getPreferences()).thenReturn(preferences);
when(uiService.currentThemeProperty()).thenReturn(new SimpleObjectProperty<>());
instance = new SettingsController(userService, preferenceService, uiService, i18n, eventBus, notificationService);
loadFxml("theme/settings/settings.fxml", param -> instance);
}
use of com.faforever.client.preferences.Preferences in project downlords-faf-client by FAForever.
the class GameBinariesUpdateTaskTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
instance = new GameBinariesUpdateTaskImpl(i18n, preferencesService, new ClientProperties());
Path faPath = faDirectory.getRoot().toPath();
java.nio.file.Files.createDirectories(faPath.resolve("bin"));
Preferences preferences = new Preferences();
preferences.getForgedAlliance().setPath(faPath);
when(preferencesService.getFafBinDirectory()).thenReturn(fafBinDirectory.getRoot().toPath());
when(preferencesService.getPreferences()).thenReturn(preferences);
}
Aggregations