UNIT-TESTING-BASICS5 MIN READ
Choose The Right Test Double
Select the simplest test double based on whether the test needs data, behavior verification, or a lightweight implementation.
InvoiceService.markOverdue needs the current date. The desired behavior is that an invoice due yesterday becomes overdue. The clock is awkward because real time changes; the date comparison itself is not the behavior you want to lock down.
Read the full lesson
Sign up free — one personalized lesson every day, matched to your role and goals.
Already have an account? Sign in