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

org.loadui.testfx.Assertions Maven / Gradle / Ivy

package org.loadui.testfx;

import org.hamcrest.Matcher;

import static org.hamcrest.MatcherAssert.assertThat;

public class Assertions
{
	@SuppressWarnings( "unchecked" )
	public static void assertNodeExists( Matcher matcher )
	{
		GuiTest.find( ( Matcher )matcher );
	}

	public static void assertNodeExists( String query )
	{
		GuiTest.find( query );
	}

	public static  void verifyThat( T value, Matcher matcher )
	{
		verifyThat( "", value, matcher );
	}

	public static  void verifyThat( String reason, T value, Matcher matcher )
	{
		try
		{
			assertThat( reason, value, matcher );
		}
		catch( AssertionError e )
		{
			throw new AssertionError( e.getMessage() + " Screenshot saved as " + GuiTest.captureScreenshot().getAbsolutePath() , e );
		}
	}
}