Hamcrest Matchers

public class GameChecker extends TypeSafeMatcher<MyGame>
{
	@Override
	public void describeTo(final Description description)
	{
		description.appendText("The map was not empty");
	}

	@Override
	protected boolean matchesSafely(final MyGame game)
	{
		return game.getMap().isEmpty();
	}

	@Factory
	public static Matcher<? super MyGame> isMapEmpty()
	{
		return new GameChecker();
	}
}

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>