java - How to assertThat something is null with Hamcrest? -
how assertthat
null
?
for example
assertthat(attr.getvalue(), is(""));
but error saying cannot have null
in is(null)
.
you can use isnull.nullvalue()
method:
import static org.hamcrest.matchers.is; import static org.hamcrest.matchers.nullvalue; assertthat(attr.getvalue(), is(nullvalue()));
Comments
Post a Comment