Skip to content

What it buys in testing

The situation

A system sends notifications. The current code:

java class NotificationService { void send(String type, String to, String body) { if (type.equals("email")) { // 20 lines of SMTP } else if (type.equals("sms")) { // 15 lines of gateway calls } else if (type.equals("push")) { // 25 lines of device tokens } } }

Marketing now wants WhatsApp notifications, and the team keeps breaking SMS while adding things.

The old version needed a live SMTP server to test at all. Why does the new one not?