assertThat 에서 null 여부 확인

nullValue() 를 사용하면 됨.

 

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;


public class MyTest{
 
    @Test	
	public void test1() {
		MyClass mc = mapper.selectMyClass("inValidValue");
		assertThat(mc,  is(nullValue()));
	}
}

 

 

 

Ref