17. Chain of Responsibility
Letting each handler decide whether to answer, so the order of them is data
Gateway decides what to do with a request, and the tests pass.
It was handed a list of handlers and does not look at it — the two checks are written out here instead, so which checks run, and in what order, is a fact about this file.
A handler returns null to decline and a string to answer. Rewrite serve() to walk the chain and stop at the first handler that answers.
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
Run the tests to see where you are.