small medium large xlarge

11 Apr 2017, 20:36
Phil Losty (1 post)

Hi, I was trying to get the code described in Chapter 8 working, I was struggling with the snippet on page 165, especially this line:

server = new AtmServer(PORT, helper.getCashSlot(), helper.getMyAccount());

there is no reference anywhere in the book to where this ‘helper’ comes from; at first I tried creating a new KnowsTheDomain class, but that just caused the test step to fail as the amount in the test was $0 instead of $20.

In the classes the helper gets passed in to the constructor, I created the same kind of constructor to get it working:

public ServerHooks(KnowsTheDomain helper) { this.helper = helper; }

Just adding this for anyone else suffering the same problem as it took me a while to figure this out!

12 Apr 2017, 16:28
Seb Rose (13 posts)

Thanks for the post, Phil.

Just FYI all the sample code can be found, chapter by chapter, here.



You must be logged in to comment