Bladeren bron

Fix unit tests.

pull/377/head
Greg Holmes 9 jaren geleden
bovenliggende
commit
eb1d322dca

+ 2
- 1
channelwho/src/com/dmdirc/addons/channelwho/ConnectionHandler.java Bestand weergeven

@@ -90,7 +90,8 @@ public class ConnectionHandler {
90 90
         connectionManager.getConnections().forEach(connection ->
91 91
                 connection.getGroupChatManager().getChannels().forEach(channel -> {
92 92
                     if (channel.getWindowModel().getConfigManager().getOptionBool(domain, "sendwho")) {
93
-                        channel.requestUsersInfo();}}));
93
+                        channel.requestUsersInfo();
94
+                    }}));
94 95
     }
95 96
 
96 97
     @VisibleForTesting

+ 2
- 1
channelwho/test/com/dmdirc/addons/channelwho/ChannelWhoManagerTest.java Bestand weergeven

@@ -56,7 +56,8 @@ public class ChannelWhoManagerTest {
56 56
     public void setUp() throws Exception {
57 57
         when(connectionManager.getConnections()).thenReturn(Lists.newArrayList(connection));
58 58
         when(connectionHandlerFactory.get(connection)).thenReturn(connectionHandler);
59
-        instance = new ChannelWhoManager(connectionHandlerFactory, connectionManager, eventBus);
59
+        instance = new ChannelWhoManager("domain", connectionHandlerFactory, connectionManager,
60
+                eventBus);
60 61
         instance.load();
61 62
     }
62 63
 

+ 10
- 10
channelwho/test/com/dmdirc/addons/channelwho/ConnectionHandlerTest.java Bestand weergeven

@@ -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
 

Laden…
Annuleren
Opslaan