From 4b420f5cb4ae484b113b37fdd24c7ac27017063d Mon Sep 17 00:00:00 2001 From: Jakob Andersen Date: Tue, 12 Dec 2017 11:04:53 +0100 Subject: [PATCH] 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. --- test/src/client_utils.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/src/client_utils.dart b/test/src/client_utils.dart index cb00f34..31b7d14 100644 --- a/test/src/client_utils.dart +++ b/test/src/client_utils.dart @@ -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); }