In the previous article, I explained how to use a test double to replace a File instance and control the behavior required by a function that reads from it. With the test double in place, I was able not only to return what I needed for the scenarios where I needed reading, but also to produce errors that allowed me to test the not-so-happy path.

I got some concerned comments pointing out that the test code wasn’t reading, which was an essential part of what we were testing. I agree that the test code isn’t actually reading. It isn’t, and that is on purpose. On the one hand, reading isn’t an essential part of what we are testing. On the contrary, File is a dependency of the are_there_vulnerable_locations() met…

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help