Have you ever had the case where you had to test for the negative of something? I was helping a teammate who wanted to test that a collection was not empty. It was pretty hard to track down how to test for that.
We settled on not()
import static org.hamcrest.Matchers.not; ... ...not(hasSize(0))
This was pretty hard to find. There wasn’t much documentation on negation.
sheltonn June 30th, 2014