Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: webrtc/examples/androidjunit/src/org/appspot/apprtc/DirectRTCClientTest.java

Issue 2440433002: Fix org.mockito.Matchers deprecation warnings in DirectRTCClientTest. (Closed)
Patch Set: New isNotNull requires Java 8. Suppress deprecation warnings instead. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 package org.appspot.apprtc; 11 package org.appspot.apprtc;
12 12
13 import static org.junit.Assert.assertFalse; 13 import static org.junit.Assert.assertFalse;
14 import static org.junit.Assert.assertTrue; 14 import static org.junit.Assert.assertTrue;
15 import static org.junit.Assert.fail; 15 import static org.junit.Assert.fail;
16 import static org.mockito.Matchers.any; 16 import static org.mockito.ArgumentMatchers.any;
17 import static org.mockito.Matchers.isNotNull; 17 import static org.mockito.ArgumentMatchers.isNotNull;
18 import static org.mockito.Mockito.mock; 18 import static org.mockito.Mockito.mock;
19 import static org.mockito.Mockito.timeout; 19 import static org.mockito.Mockito.timeout;
20 import static org.mockito.Mockito.verify; 20 import static org.mockito.Mockito.verify;
21 import static org.mockito.Mockito.verifyNoMoreInteractions; 21 import static org.mockito.Mockito.verifyNoMoreInteractions;
22 22
23 import org.chromium.testing.local.LocalRobolectricTestRunner; 23 import org.chromium.testing.local.LocalRobolectricTestRunner;
24 import org.junit.Before; 24 import org.junit.Before;
25 import org.junit.Test; 25 import org.junit.Test;
26 import org.junit.runner.RunWith; 26 import org.junit.runner.RunWith;
27 import org.robolectric.annotation.Config; 27 import org.robolectric.annotation.Config;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 "hello:world" 103 "hello:world"
104 }; 104 };
105 // clang-format on 105 // clang-format on
106 106
107 for (String invalidIp : invalidIpAddresses) { 107 for (String invalidIp : invalidIpAddresses) {
108 assertFalse(invalidIp + " matched IP_PATTERN even though it shouldn't.", 108 assertFalse(invalidIp + " matched IP_PATTERN even though it shouldn't.",
109 DirectRTCClient.IP_PATTERN.matcher(invalidIp).matches()); 109 DirectRTCClient.IP_PATTERN.matcher(invalidIp).matches());
110 } 110 }
111 } 111 }
112 112
113 // TODO(sakal): Replace isNotNull(class) with isNotNull() once Java 8 is used.
114 @SuppressWarnings("deprecation")
113 @Test 115 @Test
114 public void testDirectRTCClient() { 116 public void testDirectRTCClient() {
115 server.connectToRoom(new AppRTCClient.RoomConnectionParameters(ROOM_URL, "0. 0.0.0", LOOPBACK)); 117 server.connectToRoom(new AppRTCClient.RoomConnectionParameters(ROOM_URL, "0. 0.0.0", LOOPBACK));
116 try { 118 try {
117 Thread.sleep(SERVER_WAIT); 119 Thread.sleep(SERVER_WAIT);
118 } catch (InterruptedException e) { 120 } catch (InterruptedException e) {
119 fail(e.getMessage()); 121 fail(e.getMessage());
120 } 122 }
121 client.connectToRoom( 123 client.connectToRoom(
122 new AppRTCClient.RoomConnectionParameters(ROOM_URL, "127.0.0.1", LOOPBAC K)); 124 new AppRTCClient.RoomConnectionParameters(ROOM_URL, "127.0.0.1", LOOPBAC K));
(...skipping 21 matching lines...) Expand all
144 .onRemoteIceCandidate(isNotNull(IceCandidate.class)); 146 .onRemoteIceCandidate(isNotNull(IceCandidate.class));
145 147
146 client.disconnectFromRoom(); 148 client.disconnectFromRoom();
147 verify(clientEvents, timeout(NETWORK_TIMEOUT)).onChannelClose(); 149 verify(clientEvents, timeout(NETWORK_TIMEOUT)).onChannelClose();
148 verify(serverEvents, timeout(NETWORK_TIMEOUT)).onChannelClose(); 150 verify(serverEvents, timeout(NETWORK_TIMEOUT)).onChannelClose();
149 151
150 verifyNoMoreInteractions(clientEvents); 152 verifyNoMoreInteractions(clientEvents);
151 verifyNoMoreInteractions(serverEvents); 153 verifyNoMoreInteractions(serverEvents);
152 } 154 }
153 } 155 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698