/* Copyright (c) 2000-2006 hamcrest.org */ package org.hamcrest.core; import org.hamcrest.Description; import org.hamcrest.Matcher; import org.hamcrest.Factory; import org.hamcrest.BaseMatcher; /** * A matcher that always returns true. */ public class IsAnything extends BaseMatcher { private final String description; public IsAnything() { this("ANYTHING"); } public IsAnything(String description) { this.description = description; } public boolean matches(Object o) { return true; } public void describeTo(Description description) { description.appendText(this.description); } /** * This matcher always evaluates to true. */ @Factory public static Matcher anything() { return new IsAnything(); } /** * This matcher always evaluates to true. * * @param description A meaningful string used when describing itself. */ @Factory public static Matcher anything(String description) { return new IsAnything(description); } /** * This matcher always evaluates to true. With type inference. */ @Factory public static Matcher any(@SuppressWarnings("unused")Class type) { return new IsAnything(); } }