org.hamcrest.core.IsNull Maven / Gradle / Ivy
/* Copyright (c) 2000-2010 hamcrest.org
*/
package org.hamcrest.core;
import static org.hamcrest.core.IsNot.not;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.Factory;
import org.hamcrest.BaseMatcher;
/**
* Is the value null?
*/
public class IsNull extends BaseMatcher {
@Override
public boolean matches(Object o) {
return o == null;
}
@Override
public void describeTo(Description description) {
description.appendText("null");
}
/**
* Creates a matcher that matches if examined object is null
.
*
* For example:
* assertThat(cheese, is(nullValue())
*
*/
@Factory
public static Matcher