Это утверждение компилируется, но не выполняется, хотя я точно знаю, что foo не равно нулю:
import static org.hamcrest.Matchers.is; // see http://stackoverflow.com/a/27256498/2848676
import static org.hamcrest.Matchers.not;
import static org.hamcrest.MatcherAssert.assertThat;
...
assertThat(foo, is(not(null)));
Подробнее здесь: https://stackoverflow.com/questions/274 ... -isnotnull
Мобильная версия