{"action":"created","issue":{"url":"https://api.github.com/repos/dart-lang/mockito/issues/158","repository_url":"https://api.github.com/repos/dart-lang/mockito","labels_url":"https://api.github.com/repos/dart-lang/mockito/issues/158/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/mockito/issues/158/comments","events_url":"https://api.github.com/repos/dart-lang/mockito/issues/158/events","html_url":"https://github.com/dart-lang/mockito/issues/158","id":342130287,"node_id":"MDU6SXNzdWUzNDIxMzAyODc=","number":158,"title":"Mockito can guard against misleading stubbing of real methods.","user":{"login":"srawlins","id":103167,"node_id":"MDQ6VXNlcjEwMzE2Nw==","avatar_url":"https://avatars3.githubusercontent.com/u/103167?v=4","gravatar_id":"","url":"https://api.github.com/users/srawlins","html_url":"https://github.com/srawlins","followers_url":"https://api.github.com/users/srawlins/followers","following_url":"https://api.github.com/users/srawlins/following{/other_user}","gists_url":"https://api.github.com/users/srawlins/gists{/gist_id}","starred_url":"https://api.github.com/users/srawlins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srawlins/subscriptions","organizations_url":"https://api.github.com/users/srawlins/orgs","repos_url":"https://api.github.com/users/srawlins/repos","events_url":"https://api.github.com/users/srawlins/events{/privacy}","received_events_url":"https://api.github.com/users/srawlins/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-18T00:04:26Z","updated_at":"2018-07-18T06:32:28Z","closed_at":null,"author_association":"MEMBER","body":"Take this mock:\r\n\r\n```dart\r\nclass MockA extends Mock implements A {\r\n  @override\r\n  int foo() => 7\r\n}\r\n```\r\n\r\nIf someone tries to stub `foo()`, mockito will pretend to do it, but it won't work:\r\n\r\n```dart\r\nvar a = new MockA();\r\nwhen(a.foo()).thenReturn(6);\r\na.foo(); // returns 7.\r\n```\r\n\r\nI think it would be easy for Mockito to crash on the stubbing line above. `noSuchMethod` could return `const WHEN_STUB = const Object()` during a `when` call. Then, in the `when` call, if the method returns something other than`WHEN_STUB`, like `7`, it can throw, saying \"Uh... this doesn't look like it was properly stubbed.\"\r\n\r\nWDYT @matanlurey "},"comment":{"url":"https://api.github.com/repos/dart-lang/mockito/issues/comments/405824287","html_url":"https://github.com/dart-lang/mockito/issues/158#issuecomment-405824287","issue_url":"https://api.github.com/repos/dart-lang/mockito/issues/158","id":405824287,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNTgyNDI4Nw==","user":{"login":"srawlins","id":103167,"node_id":"MDQ6VXNlcjEwMzE2Nw==","avatar_url":"https://avatars3.githubusercontent.com/u/103167?v=4","gravatar_id":"","url":"https://api.github.com/users/srawlins","html_url":"https://github.com/srawlins","followers_url":"https://api.github.com/users/srawlins/followers","following_url":"https://api.github.com/users/srawlins/following{/other_user}","gists_url":"https://api.github.com/users/srawlins/gists{/gist_id}","starred_url":"https://api.github.com/users/srawlins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srawlins/subscriptions","organizations_url":"https://api.github.com/users/srawlins/orgs","repos_url":"https://api.github.com/users/srawlins/repos","events_url":"https://api.github.com/users/srawlins/events{/privacy}","received_events_url":"https://api.github.com/users/srawlins/received_events","type":"User","site_admin":false},"created_at":"2018-07-18T06:32:28Z","updated_at":"2018-07-18T06:32:28Z","author_association":"MEMBER","body":"I hate you.\r\n\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n\r\nI tried this, you are right."}}
{"actor":{"display_login":"srawlins"}}