Use thenAnswer() instead of thenReturn() when returning a Stream. (#40)

Mockito will soon start throwing an ArgumentError if thenReturn()
is called with a Future or Stream, as this can result in difficult
to trace errors.
This commit is contained in:
Jakob Andersen 2017-12-12 11:04:53 +01:00 committed by GitHub
parent b82384ee08
commit 4b420f5cb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -118,7 +118,7 @@ class ClientHarness {
when(transport.makeRequest(any)).thenReturn(stream);
when(transport.onActiveStateChanged = captureAny).thenReturn(null);
when(stream.outgoingMessages).thenReturn(fromClient.sink);
when(stream.incomingMessages).thenReturn(toClient.stream);
when(stream.incomingMessages).thenAnswer((_) => toClient.stream);
client = new TestClient(channel);
}