Skip to content

Commit 36596e1

Browse files
committed
wip
1 parent a037b47 commit 36596e1

24 files changed

+99
-142
lines changed

src/test/java/com/faforever/client/achievements/AchievementItemControllerTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import static org.hamcrest.MatcherAssert.assertThat;
2424
import static org.junit.jupiter.api.Assertions.assertThrows;
2525
import static org.mockito.ArgumentMatchers.anyInt;
26+
import static org.mockito.Mockito.lenient;
2627
import static org.mockito.Mockito.when;
2728

2829
public class AchievementItemControllerTest extends PlatformTest {
@@ -37,7 +38,8 @@ public class AchievementItemControllerTest extends PlatformTest {
3738

3839
@BeforeEach
3940
public void setUp() throws Exception {
40-
when(i18n.number(anyInt())).thenAnswer(invocation -> String.format("%d", (int) invocation.getArgument(0)));
41+
lenient().when(i18n.number(anyInt()))
42+
.thenAnswer(invocation -> String.format("%d", (int) invocation.getArgument(0)));
4143

4244
loadFxml("theme/achievement_item.fxml", clazz -> instance);
4345
}

src/test/java/com/faforever/client/achievements/AchievementServiceTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,14 @@ public class AchievementServiceTest extends ServiceTest {
4747

4848
@BeforeEach
4949
public void setUp() throws Exception {
50-
when(fafApiAccessor.getMaxPageSize()).thenReturn(10000);
50+
5151
}
5252

5353
@Test
5454
public void testGetPlayerAchievementsForAnotherUser() throws Exception {
5555
List<PlayerAchievement> achievements = Arrays.asList(new PlayerAchievement(), new PlayerAchievement());
5656
when(fafApiAccessor.getMany(any())).thenReturn(Flux.fromIterable(achievements));
57+
when(fafApiAccessor.getMaxPageSize()).thenReturn(10000);
5758

5859
List<PlayerAchievement> playerAchievements = instance.getPlayerAchievements(PLAYER_ID).toCompletableFuture().get(5, TimeUnit.SECONDS);
5960

@@ -66,6 +67,7 @@ public void testGetPlayerAchievementsForAnotherUser() throws Exception {
6667
@Test
6768
public void testGetAchievementDefinitions() throws Exception {
6869
AchievementDefinition achievementDefinition = AchievementDefinitionBuilder.create().defaultValues().get();
70+
when(fafApiAccessor.getMaxPageSize()).thenReturn(10000);
6971

7072
when(fafApiAccessor.getMany(any())).thenReturn(Flux.just(achievementDefinition));
7173
List<AchievementDefinition> result = instance.getAchievementDefinitions().join();

src/test/java/com/faforever/client/chat/AbstractChatTabControllerTest.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,7 @@ public class AbstractChatTabControllerTest extends PlatformTest {
8888
@BeforeEach
8989
public void setup() throws Exception {
9090
when(uiService.getThemeFileUrl(any())).thenReturn(getClass().getResource("/" + UiService.CHAT_SECTION_EXTENDED));
91-
when(timeService.asShortTime(any())).thenReturn("123");
9291
when(loginService.getUsername()).thenReturn("junit");
93-
when(emoticonService.getEmoticonShortcodeDetectorPattern()).thenReturn(Pattern.compile(":uef:|:aeon:"));
94-
when(emoticonService.getBase64SvgContentByShortcode(":uef:")).thenReturn("uefBase64Content");
95-
when(emoticonService.getBase64SvgContentByShortcode(":aeon:")).thenReturn("aeonBase64Content");
9692

9793
fxApplicationThreadExecutor.executeAndWait(() -> {
9894
instance = new AbstractChatTabController(loginService, chatService, playerService,
@@ -192,12 +188,16 @@ public void testOnSendMessageSendActionFailed() {
192188

193189
@Test
194190
public void testOnChatMessage() {
191+
when(timeService.asShortTime(any())).thenReturn("123");
192+
195193
// TODO assert something, maybe we can spy on engine
196194
runOnFxThreadAndWait(() -> instance.onChatMessage(new ChatMessage(Instant.now(), "junit", "Test message")));
197195
}
198196

199197
@Test
200198
public void testOnChatMessageAction() {
199+
when(timeService.asShortTime(any())).thenReturn("123");
200+
201201
// TODO assert something, maybe we can spy on engine
202202
runOnFxThreadAndWait(() -> instance.onChatMessage(new ChatMessage(Instant.now(), "junit", "Test action", true)));
203203
}
@@ -263,6 +263,10 @@ public void testSeveralChannelNamesTransformedToHyperlinks() {
263263

264264
@Test
265265
public void testTransformEmoticonShortcodesToImages() {
266+
when(emoticonService.getEmoticonShortcodeDetectorPattern()).thenReturn(Pattern.compile(":uef:|:aeon:"));
267+
when(emoticonService.getBase64SvgContentByShortcode(":uef:")).thenReturn("uefBase64Content");
268+
when(emoticonService.getBase64SvgContentByShortcode(":aeon:")).thenReturn("aeonBase64Content");
269+
266270
String text = ":uef: Hello, world :aeon:";
267271
assertEquals("<img src=\"data:image/svg+xml;base64,uefBase64Content\" width=\"24\" height=\"24\" /> " +
268272
"Hello, world <img src=\"data:image/svg+xml;base64,aeonBase64Content\" width=\"24\" height=\"24\" />",

src/test/java/com/faforever/client/chat/ChatChannelTabControllerTest.java

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@
4646
import static com.faforever.client.theme.UiService.CHAT_CONTAINER;
4747
import static com.faforever.client.theme.UiService.CHAT_SECTION_COMPACT;
4848
import static com.faforever.client.theme.UiService.CHAT_TEXT_COMPACT;
49-
import static com.faforever.client.theme.UiService.CHAT_TEXT_EXTENDED;
5049
import static org.junit.jupiter.api.Assertions.assertEquals;
5150
import static org.junit.jupiter.api.Assertions.assertFalse;
5251
import static org.junit.jupiter.api.Assertions.assertNotNull;
5352
import static org.junit.jupiter.api.Assertions.assertTrue;
5453
import static org.mockito.ArgumentMatchers.any;
5554
import static org.mockito.ArgumentMatchers.eq;
55+
import static org.mockito.Mockito.lenient;
5656
import static org.mockito.Mockito.mock;
5757
import static org.mockito.Mockito.never;
5858
import static org.mockito.Mockito.verify;
@@ -114,17 +114,19 @@ public void setUp() throws Exception {
114114
when(uiService.createShowingProperty(any())).thenReturn(new SimpleBooleanProperty(true));
115115
when(loginService.getUsername()).thenReturn(USER_NAME);
116116
when(uiService.getThemeFileUrl(CHAT_CONTAINER)).thenReturn(getClass().getResource("/theme/chat/chat_container.html"));
117-
when(uiService.getThemeFileUrl(CHAT_SECTION_COMPACT)).thenReturn(getClass().getResource("/theme/chat/compact/chat_section.html"));
118-
when(uiService.getThemeFileUrl(CHAT_TEXT_EXTENDED)).thenReturn(getClass().getResource("/theme/chat/extended/chat_text.html"));
119-
when(uiService.getThemeFileUrl(CHAT_TEXT_COMPACT)).thenReturn(getClass().getResource("/theme/chat/compact/chat_text.html"));
120-
when(timeService.asShortTime(any())).thenReturn("now");
121-
when(emoticonService.getEmoticonShortcodeDetectorPattern()).thenReturn(Pattern.compile("-----"));
122-
when(chatService.getOrCreateChatUser(any(String.class), eq(CHANNEL_NAME))).thenReturn(new ChatChannelUser("junit", "test"));
117+
lenient().when(uiService.getThemeFileUrl(CHAT_SECTION_COMPACT))
118+
.thenReturn(getClass().getResource("/theme/chat/compact/chat_section.html"));
119+
lenient().when(uiService.getThemeFileUrl(CHAT_TEXT_COMPACT))
120+
.thenReturn(getClass().getResource("/theme/chat/compact/chat_text.html"));
121+
lenient().when(timeService.asShortTime(any())).thenReturn("now");
122+
lenient().when(emoticonService.getEmoticonShortcodeDetectorPattern()).thenReturn(Pattern.compile("-----"));
123+
lenient().when(chatService.getOrCreateChatUser(any(String.class), eq(CHANNEL_NAME)))
124+
.thenReturn(new ChatChannelUser("junit", "test"));
123125
when(chatUserListController.chatChannelProperty()).thenReturn(new SimpleObjectProperty<>());
124126
when(loginService.getUsername()).thenReturn(USER_NAME);
125127

126128
Stage stage = mock(Stage.class);
127-
when(stage.focusedProperty()).thenReturn(new SimpleBooleanProperty());
129+
lenient().when(stage.focusedProperty()).thenReturn(new SimpleBooleanProperty());
128130

129131
StageHolder.setStage(stage);
130132

@@ -403,7 +405,6 @@ public void testNormalMentionDoesNotTriggerNotificationFromFoe() {
403405
public void getInlineStyleChangeToRandom() {
404406
ChatChannelUser chatUser = ChatChannelUserBuilder.create(USER_NAME, CHANNEL_NAME).defaultValues().get();
405407

406-
when(chatService.getOrCreateChatUser(USER_NAME, CHANNEL_NAME)).thenReturn(chatUser);
407408
initializeDefaultChatChannel();
408409
runOnFxThreadAndWait(() -> {
409410
chatPrefs.setChatColorMode(ChatColorMode.RANDOM);
@@ -448,7 +449,6 @@ public void getInlineStyleRandomFoeHide() {
448449
.socialStatus(FOE)
449450
.get()).get();
450451

451-
when(chatService.getOrCreateChatUser(USER_NAME, CHANNEL_NAME)).thenReturn(chatUser);
452452
initializeDefaultChatChannel();
453453
runOnFxThreadAndWait(() -> {
454454
chatPrefs.setChatColorMode(ChatColorMode.RANDOM);
@@ -464,14 +464,7 @@ public void getInlineStyleRandomFoeHide() {
464464
@Test
465465
public void getInlineStyleRandomFoeShow() {
466466
ChatChannelUser chatUser = ChatChannelUserBuilder.create(USER_NAME, CHANNEL_NAME).defaultValues().get();
467-
when(playerService.getPlayerByNameIfOnline(USER_NAME))
468-
.thenReturn(Optional.of(PlayerBeanBuilder.create()
469-
.defaultValues()
470-
.username(USER_NAME)
471-
.socialStatus(FOE)
472-
.get()));
473-
474-
when(chatService.getOrCreateChatUser(USER_NAME, CHANNEL_NAME)).thenReturn(chatUser);
467+
475468
initializeDefaultChatChannel();
476469
runOnFxThreadAndWait(() -> {
477470
chatPrefs.setChatColorMode(ChatColorMode.RANDOM);

src/test/java/com/faforever/client/chat/ChatControllerTest.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
import com.faforever.client.test.PlatformTest;
66
import com.faforever.client.theme.UiService;
77
import com.faforever.client.user.LoginService;
8-
import com.faforever.commons.api.dto.MeResult;
98
import com.google.common.eventbus.EventBus;
109
import javafx.beans.InvalidationListener;
11-
import javafx.beans.property.SimpleBooleanProperty;
1210
import javafx.beans.property.SimpleObjectProperty;
1311
import javafx.collections.MapChangeListener;
1412
import javafx.scene.control.Tab;
@@ -27,7 +25,6 @@
2725
import static org.hamcrest.MatcherAssert.assertThat;
2826
import static org.hamcrest.Matchers.hasSize;
2927
import static org.junit.jupiter.api.Assertions.assertEquals;
30-
import static org.mockito.ArgumentMatchers.any;
3128
import static org.mockito.ArgumentMatchers.anyString;
3229
import static org.mockito.Mockito.doAnswer;
3330
import static org.mockito.Mockito.doReturn;
@@ -66,11 +63,6 @@ public class ChatControllerTest extends PlatformTest {
6663
public void setUp() throws Exception {
6764
connectionState = new SimpleObjectProperty<>(ConnectionState.DISCONNECTED);
6865

69-
when(uiService.loadFxml("theme/chat/private_chat_tab.fxml")).thenReturn(privateChatTabController);
70-
when(uiService.loadFxml("theme/chat/channel_tab.fxml")).thenReturn(channelTabController);
71-
when(uiService.createShowingProperty(any())).thenReturn(new SimpleBooleanProperty(true));
72-
when(loginService.getUsername()).thenReturn(TEST_USER_NAME);
73-
when(loginService.getOwnUser()).thenReturn(new MeResult());
7466
when(chatService.connectionStateProperty()).thenReturn(connectionState);
7567

7668
loadFxml("theme/chat/chat.fxml", clazz -> instance);

src/test/java/com/faforever/client/chat/ChatUserItemControllerTest.java

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,6 @@ public void setUp() throws Exception {
8888
defaultUser = ChatChannelUserBuilder.create(USER_NAME, CHANNEL_NAME).defaultValues().get();
8989

9090
when(uiService.createShowingProperty(any())).thenReturn(new SimpleBooleanProperty(true));
91-
when(mapService.isInstalledBinding(anyString())).thenReturn(new SimpleBooleanProperty());
92-
when(i18n.get(eq("clan.messageLeader"))).thenReturn("Message clan leader");
93-
when(i18n.get(eq("clan.visitPage"))).thenReturn("Visit clan website");
94-
doAnswer(invocation -> new SimpleObjectProperty<>(invocation.getArgument(0))).when(imageViewHelper)
95-
.createPlaceholderImageOnErrorObservable(any());
9691

9792
loadFxml("theme/chat/chat_user_item.fxml", param -> instance);
9893
}
@@ -126,6 +121,12 @@ public void testDoubleClickInitiatesPrivateChat() {
126121

127122
@Test
128123
public void testCheckShowMapNameListener() {
124+
when(mapService.isInstalledBinding(anyString())).thenReturn(new SimpleBooleanProperty());
125+
when(i18n.get(eq("clan.messageLeader"))).thenReturn("Message clan leader");
126+
when(i18n.get(eq("clan.visitPage"))).thenReturn("Visit clan website");
127+
doAnswer(invocation -> new SimpleObjectProperty<>(invocation.getArgument(0))).when(imageViewHelper)
128+
.createPlaceholderImageOnErrorObservable(any());
129+
129130
PlayerBean player = PlayerBeanBuilder.create()
130131
.defaultValues()
131132
.game(GameBeanBuilder.create().defaultValues().get())
@@ -153,6 +154,12 @@ public void testInvisibleMapNameLabelWhenNoMapName() {
153154

154155
@Test
155156
public void testCheckShowMapPreviewListener() {
157+
when(mapService.isInstalledBinding(anyString())).thenReturn(new SimpleBooleanProperty());
158+
when(i18n.get(eq("clan.messageLeader"))).thenReturn("Message clan leader");
159+
when(i18n.get(eq("clan.visitPage"))).thenReturn("Visit clan website");
160+
doAnswer(invocation -> new SimpleObjectProperty<>(invocation.getArgument(0))).when(imageViewHelper)
161+
.createPlaceholderImageOnErrorObservable(any());
162+
156163
boolean visible = chatPrefs.isShowMapPreview();
157164
instance.setChatUser(defaultUser);
158165
defaultUser.setPlayer(PlayerBeanBuilder.create()
@@ -167,6 +174,12 @@ public void testCheckShowMapPreviewListener() {
167174

168175
@Test
169176
public void testCheckChatUserGameListener() {
177+
when(mapService.isInstalledBinding(anyString())).thenReturn(new SimpleBooleanProperty());
178+
when(i18n.get(eq("clan.messageLeader"))).thenReturn("Message clan leader");
179+
when(i18n.get(eq("clan.visitPage"))).thenReturn("Visit clan website");
180+
doAnswer(invocation -> new SimpleObjectProperty<>(invocation.getArgument(0))).when(imageViewHelper)
181+
.createPlaceholderImageOnErrorObservable(any());
182+
170183
GameBean game = GameBeanBuilder.create().defaultValues().host("junit").get();
171184
PlayerBean player = PlayerBeanBuilder.create()
172185
.defaultValues()

src/test/java/com/faforever/client/chat/ChatUserListControllerTest.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import static org.junit.jupiter.api.Assertions.assertFalse;
3838
import static org.junit.jupiter.api.Assertions.assertTrue;
3939
import static org.mockito.ArgumentMatchers.any;
40-
import static org.mockito.Mockito.mock;
4140
import static org.mockito.Mockito.when;
4241

4342
@Slf4j
@@ -71,14 +70,8 @@ public void setUp() throws Exception {
7170
when(uiService.loadFxml("theme/filter/filter.fxml", ChatUserFilterController.class)).thenReturn(chatUserFilterController);
7271
when(uiService.loadFxml("theme/play/game_tooltip.fxml")).thenReturn(gameInfoController);
7372
when(gameInfoController.getRoot()).thenReturn(new Pane());
74-
when(chatListItemCellFactory.getObject()).thenAnswer(invocation -> {
75-
ChatListItemCell mockCell = mock(ChatListItemCell.class);
76-
when(mockCell.getNode()).thenReturn(new Pane());
77-
return mockCell;
78-
});
7973
when(chatUserFilterController.filterStateProperty()).thenReturn(new SimpleBooleanProperty());
8074
when(chatUserFilterController.predicateProperty()).thenReturn(new SimpleObjectProperty<>(item -> true));
81-
when(chatUserFilterController.getPredicate()).thenReturn(item -> true);
8275
when(chatUserFilterController.getRoot()).thenReturn(new SplitPane());
8376
when(uiService.createShowingProperty(any())).thenReturn(new SimpleBooleanProperty(true));
8477
loadFxml("theme/chat/user_list.fxml", clazz -> instance);

src/test/java/com/faforever/client/chat/KittehChatServiceTest.java

Lines changed: 39 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
import static org.mockito.ArgumentMatchers.any;
8181
import static org.mockito.ArgumentMatchers.eq;
8282
import static org.mockito.Mockito.doAnswer;
83+
import static org.mockito.Mockito.lenient;
8384
import static org.mockito.Mockito.mock;
8485
import static org.mockito.Mockito.spy;
8586
import static org.mockito.Mockito.times;
@@ -170,51 +171,32 @@ public void setUp() throws Exception {
170171

171172
chatPrefs.setChatColorMode(DEFAULT);
172173

173-
when(loginService.getUsername()).thenReturn(CHAT_USER_NAME);
174-
175174
when(loginService.loggedInProperty()).thenReturn(loggedIn);
176-
when(defaultChannel.getClient()).thenReturn(realClient);
177-
when(defaultChannel.getName()).thenReturn(DEFAULT_CHANNEL_NAME);
178-
when(otherChannel.getClient()).thenReturn(realClient);
179-
when(otherChannel.getName()).thenReturn(OTHER_CHANNEL_NAME);
175+
lenient().when(defaultChannel.getClient()).thenReturn(realClient);
176+
lenient().when(defaultChannel.getName()).thenReturn(DEFAULT_CHANNEL_NAME);
180177

181178
Character userPrefix = '+';
182179

183-
when(user1.getClient()).thenReturn(realClient);
180+
lenient().when(user1.getClient()).thenReturn(realClient);
184181
when(user1.getNick()).thenReturn("user1");
185-
when(user1Mode.getNickPrefix()).thenReturn(userPrefix);
186182
when(defaultChannel.getUserModes(user1)).thenReturn(Optional.of(ImmutableSortedSet.orderedBy(Comparator.comparing(ChannelUserMode::getNickPrefix))
187183
.add(user1Mode)
188184
.build()));
189-
when(otherChannel.getUserModes(user1)).thenReturn(Optional.of(ImmutableSortedSet.orderedBy(Comparator.comparing(ChannelUserMode::getNickPrefix))
190-
.add(user1Mode)
191-
.build()));
192185

193-
when(user2.getClient()).thenReturn(realClient);
186+
lenient().when(user2.getClient()).thenReturn(realClient);
194187
when(user2.getNick()).thenReturn("user2");
195-
when(user2Mode.getNickPrefix()).thenReturn(userPrefix);
196-
when(defaultChannel.getUserModes(user1)).thenReturn(Optional.of(ImmutableSortedSet.orderedBy(Comparator.comparing(ChannelUserMode::getNickPrefix))
188+
lenient().when(user2Mode.getNickPrefix()).thenReturn(userPrefix);
189+
lenient().when(defaultChannel.getUserModes(user1))
190+
.thenReturn(Optional.of(ImmutableSortedSet.orderedBy(Comparator.comparing(ChannelUserMode::getNickPrefix))
197191
.add(user2Mode)
198192
.build()));
199-
when(otherChannel.getUserModes(user1)).thenReturn(Optional.of(ImmutableSortedSet.orderedBy(Comparator.comparing(ChannelUserMode::getNickPrefix))
200-
.add(user1Mode)
201-
.build()));
202193

203194
player1 = PlayerBeanBuilder.create().defaultValues().get();
204-
when(playerService.getPlayerByNameIfOnline(user1.getNick())).thenReturn(Optional.of(player1));
205-
when(playerService.getPlayerByNameIfOnline(user2.getNick())).thenReturn(Optional.empty());
195+
lenient().when(playerService.getPlayerByNameIfOnline(user1.getNick())).thenReturn(Optional.of(player1));
196+
lenient().when(playerService.getPlayerByNameIfOnline(user2.getNick())).thenReturn(Optional.empty());
206197

207-
when(spyClient.getChannel(DEFAULT_CHANNEL_NAME)).thenReturn(Optional.of(defaultChannel));
208-
when(spyClient.getChannel(OTHER_CHANNEL_NAME)).thenReturn(Optional.of(otherChannel));
209-
when(defaultChannel.getUser(user1.getNick())).thenReturn(Optional.of(user1));
210-
when(otherChannel.getUser(user1.getNick())).thenReturn(Optional.of(user1));
211-
when(defaultChannel.getUser(user2.getNick())).thenReturn(Optional.of(user2));
212-
213-
doAnswer(invocation -> {
214-
Runnable runnable = invocation.getArgument(0);
215-
runnable.run();
216-
return null;
217-
}).when(fxApplicationThreadExecutor).execute(any());
198+
lenient().when(spyClient.getChannel(DEFAULT_CHANNEL_NAME)).thenReturn(Optional.of(defaultChannel));
199+
lenient().when(defaultChannel.getUser(user1.getNick())).thenReturn(Optional.of(user1));
218200

219201
instance.afterPropertiesSet();
220202

@@ -378,6 +360,12 @@ public void testOnUsersJoinedChannel() {
378360

379361
@Test
380362
public void testOnPlayerOnline() {
363+
doAnswer(invocation -> {
364+
Runnable runnable = invocation.getArgument(0);
365+
runnable.run();
366+
return null;
367+
}).when(fxApplicationThreadExecutor).execute(any());
368+
381369
connect();
382370

383371
join(defaultChannel, user2);
@@ -432,6 +420,13 @@ public void testOnChatUserLeftChannel() {
432420

433421
@Test
434422
public void testOnChatUserQuit() {
423+
when(otherChannel.getClient()).thenReturn(realClient);
424+
when(otherChannel.getName()).thenReturn(OTHER_CHANNEL_NAME);
425+
when(user1Mode.getNickPrefix()).thenReturn('+');
426+
when(otherChannel.getUserModes(user1)).thenReturn(Optional.of(ImmutableSortedSet.orderedBy(Comparator.comparing(ChannelUserMode::getNickPrefix))
427+
.add(user1Mode)
428+
.build()));
429+
435430
ChatChannel chatChannel1 = instance.getOrCreateChannel(defaultChannel.getName());
436431
ChatChannel chatChannel2 = instance.getOrCreateChannel(otherChannel.getName());
437432
assertThat(chatChannel1.getUsers(), empty());
@@ -635,6 +630,20 @@ public void testGetChatUsersForChannelEmpty() {
635630

636631
@Test
637632
public void testGetChatUsersForChannelTwoUsersInDifferentChannels() {
633+
when(otherChannel.getClient()).thenReturn(realClient);
634+
when(otherChannel.getName()).thenReturn(OTHER_CHANNEL_NAME);
635+
when(otherChannel.getUserModes(user1)).thenReturn(Optional.of(ImmutableSortedSet.orderedBy(Comparator.comparing(ChannelUserMode::getNickPrefix))
636+
.add(user1Mode)
637+
.build()));
638+
when(spyClient.getChannel(OTHER_CHANNEL_NAME)).thenReturn(Optional.of(otherChannel));
639+
when(otherChannel.getUser(user1.getNick())).thenReturn(Optional.of(user1));
640+
when(defaultChannel.getUser(user2.getNick())).thenReturn(Optional.of(user2));
641+
doAnswer(invocation -> {
642+
Runnable runnable = invocation.getArgument(0);
643+
runnable.run();
644+
return null;
645+
}).when(fxApplicationThreadExecutor).execute(any());
646+
638647
connect();
639648
join(defaultChannel, user1);
640649
join(otherChannel, user2);

0 commit comments

Comments
 (0)