Module 4 – Make assumptions visible and defend your result
A test must be capable of failing
Temporarily change the function body to return Current. Predict which promise this breaks before running it. The changed program should fail with assertion checking enabled. Restore the correct body and rerun. This small deliberate defect checks that your evidence can reveal the error you care about; a success message printed unconditionally would not do that.
A call at 10 violates the precondition. Test it separately as an expected failure, and record the observed exception rather than including it before every successful test. Assertions may be disabled under another build policy. Record the build settings, and keep user-input validation as explicit application behavior when rejection is required in every supported build.
Complete this lesson
Answer every check correctly to earn your lesson certificate. Feedback helps you review and try again.
Sign in · Save your progress and earn a certificate for this lesson.