/*  Copyright (c) 2000-2010 hamcrest.org
 */
package org.hamcrest.core;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsAnything.anything;

import org.hamcrest.AbstractMatcherTest;
import org.hamcrest.Matcher;

public class IsAnythingTest extends AbstractMatcherTest {

    @Override
    protected Matcher<?> createMatcher() {
        return anything();
    }

    public void testAlwaysEvaluatesToTrue() {
        assertThat(null, anything());
        assertThat(new Object(), anything());
        assertThat("hi", anything());
    }

    public void testHasUsefulDefaultDescription() {
        assertDescription("ANYTHING", anything());
    }

    public void testCanOverrideDescription() {
        String description = "description";
        assertDescription(description, anything(description));
    }

}

/*  Copyright (c) 2000-2010 hamcrest.org
 */
package org.hamcrest.core;

import static org.hamcrest.AbstractMatcherTest.assertDescription;
import static org.hamcrest.AbstractMatcherTest.assertMatches;
import static org.hamcrest.core.IsAnything.anything;

import org.hamcrest.Matcher;
import org.junit.Test;

public final class IsAnythingTest {

    private final Matcher<Object> matcher = anything();

    private static class CustomThing { }
    
    @Test public void
    alwaysEvaluatesToTrue() {
        assertMatches("didn't match null", matcher, null);
        assertMatches("didn't match Object", matcher, new Object());
        assertMatches("didn't match custom object", matcher, new CustomThing());
        assertMatches("didn't match String", matcher, "hi");
    }

    @Test public void
    hasUsefulDefaultDescription() {
        assertDescription("ANYTHING", matcher);
    }

    @Test public void
    canOverrideDescription() {
        String description = "description";
        assertDescription(description, anything(description));
    }

}

convert to JUnit4 test