honeytrap.devexercisesdecorator.javaSettings
Description

13. Decorator

MediumStructural1 hidden requirement

Adding behaviour by wrapping, so two additions compose without knowing about each other

Alerts sends a message, and the tests pass for email alone and for email wrapped in SMS.

It builds the text itself and then checks what kind of notifier it was handed, adding a layer per kind. Each check is independent, so nothing stops two from being wrong together — and nothing makes them nest in the right order.

Every notifier already implements send(), and the wrapping ones call through to what they hold. Rewrite raise() to send.

Run compiles every file and runs Tests.java — the tests you can read.

Submit runs those again, then applies 1 requirement you have not seen, one at a time.

Your code is never edited. Each requirement is added to the project as it stands. If the design is right, nothing you wrote has to change.

  • Ctrl/⌘ + Enter runs the tests