0

I see with() method being used with assertThat() method in test driven development, but I don't understand what with() does. Could somebody explain with a clear example. I can't seem to find anything on it.

Thank you.

T L
  • 39
  • 1
  • 2
  • 6

1 Answers1

1

It allows you to specify a set of acceptable inputs. I think it's intended to read like English, for example "calling add with any integer."

Here's a sample from the cheat sheet linked below:

allowing (calculator).add(with(any(int.class)), with(any(int.class)));

http://jmock.org/cheat-sheet.html

Arthur Dent
  • 785
  • 3
  • 7