All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hamcrest.core.IsNull Maven / Gradle / Ivy

Go to download

A self-contained hamcrest jar containing all of the sub-modules in a single artifact.

There is a newer version: 1.3
Show newest version
/*  Copyright (c) 2000-2006 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 {
    public boolean matches(Object o) {
        return o == null;
    }

    public void describeTo(Description description) {
        description.appendText("null");
    }

    /**
     * Matches if value is null.
     */
    @Factory
    public static  Matcher nullValue() {
        return new IsNull();
    }

    /**
     * Matches if value is not null.
     */
    @Factory
    public static  Matcher notNullValue() {
        return not(IsNull.nullValue());
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy