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

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -