So far, I've implemented two things:
BasicTemplateableString(implements TemplateableString)
I felt like this interface was lacking some setters, so I decided to add those
since it made sense to me to be able to reset a component's default string,
even after creation.
I tested for basic functionality, and that when something was null that null pointer exceptions were being thrown.
I also tested the behavior correctness when the "hasReplacement" boolean was set to false.
BasicGameSession (implements GameSession)
This class proved trickier than I thought.
For starters, the test for this class is only one test (which makes me kind of nervous). All it does it test that when the addAction(GameAction ga) method receives a null value, a NPE will be thrown.
I had no idea how to test for correct behavior, since there are no getters and setters to see what the undo and redo stack for a game session will be.
When I first looked at the interface, all it had was getGame() and getGameActions(), which returned a list.
I felt like the GameSession should handle undoing and redoing actions on it's own, rather than leaving that to some other component.
And now that I'm writing about it, I Feel like game action should have way of storing all the actions ever performed, in order to be able to retrieve them easily for the ActionEvent log which will be returned to the Designer. But anywho....
I changed the GameSession interface to have a undoAction, redoAction and addAction(GameAction) methods.
I had never done a undo/redo stack, and since I had no way of testing it, I made a scratch file in another package, in which I had an undo stack, redo stack, and add method. These took strings, and they would print after every step. Below, I'll attempt to explain how things came to be.
Initialized to empty
[U]: THE UNDOABLE STACK
[R]: THE REDOABLE STACK
Added strings (one,two,three)
[U]: one
[R]:
[U]: one two
[R]:
[U]: one two three
[R]:
Undid 2 actions.
[U]: one two
[R]:three
[U]: one
[R]:three two
Redid 3 actions, the third one did not have any effect
[U]: one two
[R]:three
[U]: one two three
[R]:
Undid another action
[U]: one two
[R]:three
ADDED AN ACTION (four) which, in my mind, should reset the redo queue
[U]: one two four
[R]:
Undid 3 actions
[U]: one two
[R]:four
[U]: one
[R]:four two
[U]:
[R]:four two one
Since the correct behavior of undo/redo stacks wasn't clear to me, I played around in eclipse by typing, then undoing the typing of 3 lines, and redoing them 3 times (then I noticed the 4th call wouldn't let me redo anything). Then I undid 2 of them, and typed a new line. I noticed the REDO option wouldn't do anything after I added a new thing, which coincides with how my scratch program worked.