Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • I'm aware of those techniques and I used them a lot over the time. My question is: does it really makes sense? As I wrote in the question: What do I test when I use a mocked EmailSender? I still don't know if the e-mail was really sent. I agree with your conclusion, it reflects my actual state of mind. Thank you! Commented Mar 15, 2019 at 8:15
  • @ttulka You're testing if the actual call was made to send the e-mail. You're testing the logic in your method prior to the actual send, including any alternations you may have made to the e-mail or conditions you may have had for not sending. By using a mocked EmailSender to test, you're testing the code part of the method. The rest is different in that regard. You can "test" the actual sending of the e-mail and not have a guarantee it will work in production. Commented Mar 15, 2019 at 8:24