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

Unlock this course with a free trial

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

Mockito syntax options

Mockito syntax options

- [Instructor] I'd like to finish this chapter by looking at the syntax of Mockito's verify statement one more time and just talking through some of the other options that you might find useful. For the times part we've already seen that you can do times and then an integer in brackets to indicate for example, zero times, one time, and so on. We could also use some alternative methods in here to give us a bit more flexibility. We can call the methods at least or at most to indicate that this method that we're trying to test, the my method in the example on screen, should be called at least two times or at most seven times. And if you prefer, rather than times zero, you can use the never method as an alternative syntax. And actually times one is the default value, so if you miss out this second parameter, that means the method call should happen exactly one time. So with that knowledge we can actually edit our project very slightly. We can say in this example we don't need the second…

Contents