Skip to content

Commit f6801e0

Browse files
rkjsrawlins
authored andcommitted
Modify example to show how to use argument for when. (dart-lang/mockito#76)
Each time it takes me long time to find actual problem and solution, when I run into this problem.
1 parent 0f5c4f9 commit f6801e0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkgs/mockito/lib/src/mock.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void throwOnMissingStub(Mock mock) {
5555
///
5656
/// // Real class.
5757
/// class Cat {
58-
/// String getSound() => 'Meow';
58+
/// String getSound(String suffix) => 'Meow$suffix';
5959
/// }
6060
///
6161
/// // Mock class.
@@ -66,10 +66,10 @@ void throwOnMissingStub(Mock mock) {
6666
/// var cat = new MockCat();
6767
///
6868
/// // When 'getSound' is called, return 'Woof'
69-
/// when(cat.getSound()).thenReturn('Woof');
69+
/// when(cat.getSound(typed(any))).thenReturn('Woof');
7070
///
7171
/// // Try making a Cat sound...
72-
/// print(cat.getSound()); // Prints 'Woof'
72+
/// print(cat.getSound('foo')); // Prints 'Woof'
7373
/// }
7474
///
7575
/// **WARNING**: [Mock] uses [noSuchMethod](goo.gl/r3IQUH), which is a _form_ of

0 commit comments

Comments
 (0)