From the course: Practical Test-Driven Development for Java Programmers

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Creating the stub

Creating the stub

- [Narrator] Let's go and do that then. So in the test, before we start any of this code, I'm going to create my own version of this external data service. We'll call it test service. And I'm going to set it equal to a new external ispn data service because this is an interface eclipses has given me in line the implementation that I need to override. So for this particular test, I'm assuming our external ispn data service is going to return a new book with the data of an ispn number that matches that (mumbling) the title, which is going to be Of Mice and Men, and the author, which is James Steinbeck. Of Mice and Men, and the author, which is James Steinbeck. So, just to be clear here I'm creating a simulation or an overriding version of what some external third party web service will be doing so that we don't have to call that external third party web service. I'm providing the minimum implementation I can get away with to get it this work because I'm not trying to test the external…

Contents