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.
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)));