From the course: Programming Foundations: Test-Driven Development

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

✓ Solution: Functionality

✓ Solution: Functionality - Java Tutorial

From the course: Programming Foundations: Test-Driven Development

Start my 1-month free trial

✓ Solution: Functionality

(upbeat music) - [Narrator] In this challenge you had to write test cases for the fetch clue functionality for three scenarios, before any guess is entered, after a correct guess is entered and after an incorrect guess is entered. So I'm in test hangman.java and I will write my next test case for the first requirement as test fetchClueBeforeAnyGuess. As usual I'll first create a Hangman instance and invoke the new method which I will have to create as fetchClue to which I will pass the word for which the clue has to be created. And this I will store and let's say a string variable. To deal with the compilation problem, I'll create this method as suggested, save it, come back. I'll now make an assertion that this clue equals, five dashes and then run the test case. It is read as expected. Now coming back, this is the word that had come as a parameter and all I have to do is, replace all its characters with dashes. So for that I'll first create stingBuilder call as clue. And then in a…

Contents