Merge "[Feature sync] Fix flaky test in MdnsSocketClientTests"
This commit is contained in:
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertNull;
|
|||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
|
import static org.mockito.ArgumentMatchers.argThat;
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
import static org.mockito.Mockito.doAnswer;
|
import static org.mockito.Mockito.doAnswer;
|
||||||
import static org.mockito.Mockito.never;
|
import static org.mockito.Mockito.never;
|
||||||
@@ -513,11 +514,8 @@ public class MdnsSocketClientTests {
|
|||||||
mdnsClient.setCallback(mockCallback);
|
mdnsClient.setCallback(mockCallback);
|
||||||
mdnsClient.startDiscovery();
|
mdnsClient.startDiscovery();
|
||||||
|
|
||||||
ArgumentCaptor<MdnsResponse> mdnsResponseCaptor =
|
verify(mockCallback, timeout(TIMEOUT).atLeastOnce())
|
||||||
ArgumentCaptor.forClass(MdnsResponse.class);
|
.onResponseReceived(argThat(response -> response.getInterfaceIndex() == 21));
|
||||||
verify(mockCallback, timeout(TIMEOUT).atLeast(1))
|
|
||||||
.onResponseReceived(mdnsResponseCaptor.capture());
|
|
||||||
assertEquals(21, mdnsResponseCaptor.getValue().getInterfaceIndex());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user