mirror of https://github.com/grpc/grpc-dart.git
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:
parent
b82384ee08
commit
4b420f5cb4
|
|
@ -118,7 +118,7 @@ class ClientHarness {
|
||||||
when(transport.makeRequest(any)).thenReturn(stream);
|
when(transport.makeRequest(any)).thenReturn(stream);
|
||||||
when(transport.onActiveStateChanged = captureAny).thenReturn(null);
|
when(transport.onActiveStateChanged = captureAny).thenReturn(null);
|
||||||
when(stream.outgoingMessages).thenReturn(fromClient.sink);
|
when(stream.outgoingMessages).thenReturn(fromClient.sink);
|
||||||
when(stream.incomingMessages).thenReturn(toClient.stream);
|
when(stream.incomingMessages).thenAnswer((_) => toClient.stream);
|
||||||
client = new TestClient(channel);
|
client = new TestClient(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue