18. Command
MediumBehavioural1 hidden requirement
Making an action an object that carries its own undo, so a history is just a list
Session applies edits to a document and can undo the last one. The tests pass.
It remembers one thing: the text as it was before the most recent edit. So undo goes back exactly one step, and only for edits that changed the text.
Every Command already knows how to undo itself. Rewrite Session to keep the commands it has run.
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.
Hidden requirements
Stdout
TERMINALPROBLEMSOUTPUT
Try:
honeytrap shell. Two commands are wired up: cd and cat.