In this video, we're going to try and connect the step definitions that we've created for the Cucumber feature file to the Microwave so that we can actually do something useful with it. So, a couple of things to note; we have this StepDefs class that is going to be associated with the steps in a scenario in Cucumber. So, the first question you might ask yourself is, "When is the StepDefs created, and when is it destroyed?" Well, it turns out that for each scenario, we create a new instance of the StepDefs class. So, the StepDefs class or whatever class that you have that's associated with the steps that you've written in Cucumber will be created and destroyed for each scenario that we build. So the thing we need to do, because we're going to want to run through several steps on one copy of our Microwave, is we need to first create a Microwave. So, I'm going to do that here. And because of the scope of this class, we can initialize the Microwave in a class initializer per object initializer that we have for this StepDefs class. So, here we have ... I'm just going to paste it. So, I have created one here. I'm going to construct a Microwave. Oh, in order to do that I need an ArrayList. So, when I construct a Microwave, it takes as arguments the ModeController, the DisplayController, and the timePerTick, remember this thing runs periodically, and a list of presets. For the moment, I'm going to leave the list of presets empty. We'll come back to that in the next lesson. So, we can start looking at the steps that we wish to do. And, something interesting comes up right away. So, here we're claiming that initially the Microwave is in the Setup mode. Now, that's just the way the microwave is initialized. So, in this case, we don't really need to claim it here, we don't need to have it as a given because every time we construct a scenario, that will be the way the Microwave is set up. So, even though it is in the use case, it's not really necessary for the test. So, I'm going to remove it here and I'm going to remove it here. So, we go back to our step definitions. And now rather than print out something that the Microwave is closed, we're going to actually close the door. So, "microwave.setDoorOpen(false)". So now, we've ensured that the door is closed. And if we want to talk about the user pressing a key, well we have a method on the Microwave to do that. So, digitPressed() and this will be "arg1" because that's the argument that corresponds to the digit. Often, we want to rename these so that they're more meaningful. And the other thing that we want to do, the time at which the microwave actually registers that these things happened because it runs periodically is that a tick? So, we actually have to tell the Microwave not only that there was a digit pressed, but we have to run through a tick so it records the DisplayController and the ModeController. So we can do something similar here for the "start key". I'm going to get rid of some of these comments. "microwave.startPressed()". Now, this is an interesting one. We look at the number of seconds elapsed. What we want to do is turn this into a number of ticks, and the number of ticks depends on the tick rate, the number of ticks per second. So, we do "i < secondsElapsed*microwave.getTickTateInMS()". So really, tick down or the tick rate times the seconds elapsed. Here we go, and here's an interesting thing. So, I talked about this in the last lesson. "the display should read " and then we have a sequence of digits. Now, our display for our microwave is exactly four digits and we actually want to have the preceding 0s and following 0s, so we're going to do it this way. So, this means that we're going to get four digits in. Let's see, now this'll be "tensOfMinutes", "int minutes", "int tensOfSeconds", "int seconds". So, when we have four of these arguments, "d", "d", "d", "d", we're going to get in four values associated with them. Okay, so now we're going to actually start checking to see whether our system does the right thing. And the way we do this is, we bring in assertEquals(). So, we have "tensOfMinutes" and then on the Microwave side, let's see, "digits". And, this is going to give us back an array and the location in the array, let's see, I think this might actually come from the DisplayController. Yeah, there we go. So, we're going to ask for the location of the array there. We're getting there, "seconds, microwave.digits(), DisplayController.SECONDS". So now, we've said that each of the digits should match the positions that we've defined here. All right. I think we're getting close. We have one more thing to do. Okay, so this one's easy. "assertEquals()". Now, we want to get the "microwave.getMode()". And, the mode that we want it to be in is "ModeController.Mode.Cooking". So, we're going to assert that when we're done with our test that we're going to be in Cooking mode. So, let's take a look at our feature file again. So, Given the microwave's door is closed When they pressed the 2 and 0 keys, And they pressed the "start key", And 2 seconds elapse, Then the display should read "0018", And the microwave is in Cooking mode. Let's give this a try. And, we've got an error. So let's see, what error do we have? Oh! We have an arity mismatch. That is because of the way that I specified the DisplayController thing. So, let me take a look at that. What we want to say is we want to have separate patterns for each of these digits because it wants to give us back a single argument for a pattern which is the thing in parentheses. So, if I put all of those four things in one pattern, it's still going to give me back one integer, and what I want is four integers. All right. Now, voila, we've been able to run our tests and we can see all the responses here. We can go out and look. If we go out and look in the "build" file and we go in "reports", and we look at our tests, just like running regular junit. We can see different tests that we've run. When we look at the default package, we can look at the scenario that we've written and here are the results. So, very nicely, we've been able to integrate in our Cucumber test just like a regular junit test and bind them into the actual code that we're testing.