Kaynağa Gözat

Fix some build warnings.

pull/445/head
Chris Smith 8 yıl önce
ebeveyn
işleme
8fc7cc28da

+ 9
- 7
channelwho/test/com/dmdirc/addons/channelwho/ConnectionHandlerTest.java Dosyayı Görüntüle

55
 import static org.mockito.Matchers.any;
55
 import static org.mockito.Matchers.any;
56
 import static org.mockito.Matchers.anyLong;
56
 import static org.mockito.Matchers.anyLong;
57
 import static org.mockito.Matchers.eq;
57
 import static org.mockito.Matchers.eq;
58
+import static org.mockito.Mockito.doReturn;
58
 import static org.mockito.Mockito.never;
59
 import static org.mockito.Mockito.never;
59
 import static org.mockito.Mockito.verify;
60
 import static org.mockito.Mockito.verify;
60
 import static org.mockito.Mockito.when;
61
 import static org.mockito.Mockito.when;
67
     @Mock private WindowModel windowModel;
68
     @Mock private WindowModel windowModel;
68
     @Mock private DMDircMBassador eventBus;
69
     @Mock private DMDircMBassador eventBus;
69
     @Mock private ScheduledExecutorService scheduledExecutorService;
70
     @Mock private ScheduledExecutorService scheduledExecutorService;
70
-    @Mock private ScheduledFuture scheduledFuture;
71
+    @Mock private ScheduledFuture<?> scheduledFuture;
71
     @Mock private ConnectionManager connectionManager;
72
     @Mock private ConnectionManager connectionManager;
72
     @Mock private Connection connection;
73
     @Mock private Connection connection;
73
     @Mock private GroupChat groupChat;
74
     @Mock private GroupChat groupChat;
81
 
82
 
82
     @Before
83
     @Before
83
     public void setUp() throws Exception {
84
     public void setUp() throws Exception {
84
-        when(scheduledExecutorService.scheduleAtFixedRate(any(Runnable.class), anyLong(), anyLong(),
85
-                any())).thenReturn(scheduledFuture);
85
+        doReturn(scheduledFuture).when(
86
+                scheduledExecutorService.scheduleAtFixedRate(
87
+                        any(Runnable.class), anyLong(), anyLong(), any()));
86
         when(windowModel.getEventBus()).thenReturn(eventBus);
88
         when(windowModel.getEventBus()).thenReturn(eventBus);
87
         when(connection.getWindowModel()).thenReturn(windowModel);
89
         when(connection.getWindowModel()).thenReturn(windowModel);
88
         when(config.getBinder()).thenReturn(configBinder);
90
         when(config.getBinder()).thenReturn(configBinder);
108
         instance.load();
110
         instance.load();
109
         verify(configBinder).bind(instance, ConnectionHandler.class);
111
         verify(configBinder).bind(instance, ConnectionHandler.class);
110
         verify(eventBus).subscribe(instance);
112
         verify(eventBus).subscribe(instance);
111
-        verify(scheduledExecutorService).scheduleAtFixedRate(any(Runnable.class), eq(5l), eq(5l),
113
+        verify(scheduledExecutorService).scheduleAtFixedRate(any(Runnable.class), eq(5L), eq(5L),
112
                 eq(TimeUnit.MILLISECONDS));
114
                 eq(TimeUnit.MILLISECONDS));
113
     }
115
     }
114
 
116
 
124
     public void testHandleWhoInterval() throws Exception {
126
     public void testHandleWhoInterval() throws Exception {
125
         instance.handleWhoInterval(10);
127
         instance.handleWhoInterval(10);
126
         verify(scheduledFuture).cancel(false);
128
         verify(scheduledFuture).cancel(false);
127
-        verify(scheduledExecutorService).scheduleAtFixedRate(any(Runnable.class), eq(5l), eq(5l),
129
+        verify(scheduledExecutorService).scheduleAtFixedRate(any(Runnable.class), eq(5L), eq(5L),
128
                 eq(TimeUnit.MILLISECONDS));
130
                 eq(TimeUnit.MILLISECONDS));
129
-        verify(scheduledExecutorService).scheduleAtFixedRate(any(Runnable.class), eq(10l), eq(10l),
131
+        verify(scheduledExecutorService).scheduleAtFixedRate(any(Runnable.class), eq(10L), eq(10L),
130
                 eq(TimeUnit.MILLISECONDS));
132
                 eq(TimeUnit.MILLISECONDS));
131
     }
133
     }
132
 
134
 
148
 
150
 
149
     @Test
151
     @Test
150
     public void testHandleAwayEvent_WithReason() throws Exception {
152
     public void testHandleAwayEvent_WithReason() throws Exception {
151
-        when(channelUserAwayEvent.getReason()).thenReturn(Optional.ofNullable("reason"));
153
+        when(channelUserAwayEvent.getReason()).thenReturn(Optional.of("reason"));
152
         instance.load();
154
         instance.load();
153
         instance.handleAwayEvent(channelUserAwayEvent);
155
         instance.handleAwayEvent(channelUserAwayEvent);
154
         verify(channelUserAwayEvent, never())
156
         verify(channelUserAwayEvent, never())

+ 3
- 0
redirect/src/com/dmdirc/addons/redirect/FakeWriteableFrameContainer.java Dosyayı Görüntüle

62
     }
62
     }
63
 
63
 
64
     @Override
64
     @Override
65
+    @Deprecated
65
     public void addLine(final String type, final Date timestamp, final Object... args) {
66
     public void addLine(final String type, final Date timestamp, final Object... args) {
66
         addLine(type, args);
67
         addLine(type, args);
67
     }
68
     }
68
 
69
 
69
     @Override
70
     @Override
71
+    @Deprecated
70
     public void addLine(final String type, final Object... args) {
72
     public void addLine(final String type, final Object... args) {
71
         sendLine(Formatter.formatMessage(getConfigManager(), type, args));
73
         sendLine(Formatter.formatMessage(getConfigManager(), type, args));
72
     }
74
     }
73
 
75
 
74
     @Override
76
     @Override
77
+    @Deprecated
75
     public void addLine(final String line, final Date timestamp) {
78
     public void addLine(final String line, final Date timestamp) {
76
         addLine(line);
79
         addLine(line);
77
     }
80
     }

+ 2
- 2
ui_swing/test/com/dmdirc/addons/ui_swing/components/GenericTableModelTest.java Dosyayı Görüntüle

39
 import org.mockito.Mock;
39
 import org.mockito.Mock;
40
 import org.mockito.runners.MockitoJUnitRunner;
40
 import org.mockito.runners.MockitoJUnitRunner;
41
 
41
 
42
-import static junit.framework.Assert.assertEquals;
43
-import static junit.framework.Assert.assertSame;
42
+import static org.junit.Assert.assertEquals;
44
 import static org.junit.Assert.assertFalse;
43
 import static org.junit.Assert.assertFalse;
44
+import static org.junit.Assert.assertSame;
45
 import static org.junit.Assert.assertTrue;
45
 import static org.junit.Assert.assertTrue;
46
 import static org.mockito.Mockito.verify;
46
 import static org.mockito.Mockito.verify;
47
 
47
 

Loading…
İptal
Kaydet