|
@@ -81,8 +81,8 @@ public class ConnectionHandlerTest {
|
81
|
81
|
|
82
|
82
|
@Before
|
83
|
83
|
public void setUp() throws Exception {
|
84
|
|
- when(scheduledExecutorService.schedule(any(Runnable.class), anyLong(), any()))
|
85
|
|
- .thenReturn(scheduledFuture);
|
|
84
|
+ when(scheduledExecutorService.scheduleAtFixedRate(any(Runnable.class), anyLong(), anyLong(),
|
|
85
|
+ any())).thenReturn(scheduledFuture);
|
86
|
86
|
when(windowModel.getEventBus()).thenReturn(eventBus);
|
87
|
87
|
when(connection.getWindowModel()).thenReturn(windowModel);
|
88
|
88
|
when(config.getBinder()).thenReturn(configBinder);
|
|
@@ -107,7 +107,7 @@ public class ConnectionHandlerTest {
|
107
|
107
|
instance.load();
|
108
|
108
|
verify(configBinder).bind(instance, ConnectionHandler.class);
|
109
|
109
|
verify(eventBus).subscribe(instance);
|
110
|
|
- verify(scheduledExecutorService).schedule(any(Runnable.class), eq(5l),
|
|
110
|
+ verify(scheduledExecutorService).scheduleAtFixedRate(any(Runnable.class), eq(5l), eq(5l),
|
111
|
111
|
eq(TimeUnit.MILLISECONDS));
|
112
|
112
|
}
|
113
|
113
|
|
|
@@ -122,26 +122,26 @@ public class ConnectionHandlerTest {
|
122
|
122
|
@Test
|
123
|
123
|
public void testHandleWhoInterval() throws Exception {
|
124
|
124
|
instance.handleWhoInterval(10);
|
125
|
|
- verify(scheduledFuture).cancel(true);
|
126
|
|
- verify(scheduledExecutorService).schedule(any(Runnable.class), eq(5l),
|
|
125
|
+ verify(scheduledFuture).cancel(false);
|
|
126
|
+ verify(scheduledExecutorService).scheduleAtFixedRate(any(Runnable.class), eq(5l), eq(5l),
|
127
|
127
|
eq(TimeUnit.MILLISECONDS));
|
128
|
|
- verify(scheduledExecutorService).schedule(any(Runnable.class), eq(10l),
|
|
128
|
+ verify(scheduledExecutorService).scheduleAtFixedRate(any(Runnable.class), eq(10l), eq(10l),
|
129
|
129
|
eq(TimeUnit.MILLISECONDS));
|
130
|
130
|
}
|
131
|
131
|
|
132
|
132
|
@Test
|
133
|
133
|
public void testCheckWho_True() throws Exception {
|
134
|
|
- when(config.getOptionBool("domain", "sendWho")).thenReturn(true);
|
|
134
|
+ when(config.getOptionBool("domain", "sendwho")).thenReturn(true);
|
135
|
135
|
instance.checkWho();
|
136
|
|
- verify(config).getOptionBool("domain", "sendWho");
|
|
136
|
+ verify(config).getOptionBool("domain", "sendwho");
|
137
|
137
|
verify(groupChat).requestUsersInfo();
|
138
|
138
|
}
|
139
|
139
|
|
140
|
140
|
@Test
|
141
|
141
|
public void testCheckWho_False() throws Exception {
|
142
|
|
- when(config.getOptionBool("domain", "sendWho")).thenReturn(false);
|
|
142
|
+ when(config.getOptionBool("domain", "sendwho")).thenReturn(false);
|
143
|
143
|
instance.checkWho();
|
144
|
|
- verify(config).getOptionBool("domain", "sendWho");
|
|
144
|
+ verify(config).getOptionBool("domain", "sendwho");
|
145
|
145
|
verify(groupChat, never()).requestUsersInfo();
|
146
|
146
|
}
|
147
|
147
|
|