How would I assertThat
something is null
?
for example
assertThat(attr.getValue(), is(\"\"));
But I get an e
You can use IsNull.nullValue() method:
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;
assertThat(attr.getValue(), is(nullValue()));
If you want to hamcrest
, you can do
import static org.hamcrest.Matchers.nullValue;
assertThat(attr.getValue(), is(nullValue()));
In Junit
you can do
import static junit.framework.Assert.assertNull;
assertNull(object);
why not use assertNull(object)
/ assertNotNull(object)
?
Use the following (from Hamcrest):
assertThat(attr.getValue(), is(nullValue()));
In Kotlin is
is reserved so use:
assertThat(attr.getValue(), `is`(nullValue()));