Packageorg.flexunit
Classpublic class Assume
InheritanceAssume Inheritance Object

A set of methods useful for stating assumptions about the conditions in which a test is meaningful. A failed assumption does not mean the code is broken, but that the test provides no useful information. The default Theories runner treats tests with failing assumptions as ignored. Custom runners may behave differently. For example:
	 [Theory]
	 public function checkBasedOnValue():void {
	 	var testValue:String = getValue();
	 	Assume.assumeNotNull(testValue);
	 	// ...
	 }
	 



Public Methods
 MethodDefined By
  
assumeNoException(e:Error):void
[static] Use to assume that an operation completes normally.
Assume
  
assumeNotNull(... objects):void
[static] If called with one or more null elements in objects, the test will halt and be ignored.
Assume
  
assumeThat(actual:Object, matcher:Matcher):void
[static] Call to assume that actual satisfies the condition specified by matcher.
Assume
  
assumeTrue(b:Boolean):void
[static] If called with an expression evaluating to false, the test will halt and be ignored.
Assume
Method Detail
assumeNoException()method
public static function assumeNoException(e:Error):void

Use to assume that an operation completes normally. If e is non-null, the test will halt and be ignored. For example:

		 [Test]
		 public function createFileDirectory():void {
		 	var myFileDirectory:File = File.userDirectory.resolvePath("information");
		 	try {
		 		myFileDirectory.createDirectory();
		 	} catch (e:Error) {
		 		// stop test and ignore if data can't be opened
		 		Assume.assumeNoException(e);
		 	}
		 	// ...
		 }
		 

Parameters

e:Error — If non-null, the offending exception.

assumeNotNull()method 
public static function assumeNotNull(... objects):void

If called with one or more null elements in objects, the test will halt and be ignored.

Parameters

... objects — One or more objects to check.

assumeThat()method 
public static function assumeThat(actual:Object, matcher:Matcher):void

Call to assume that actual satisfies the condition specified by matcher. If not, the test halts and is ignored. Example:

		 Assume.assumeThat(1, is(1)); // passes
		 foo(); // will execute
		 Assume.assumeThat(0, is(1)); // assumption failure! test halts
		 int x = 1 / 0; // will never execute
		 

Parameters

actual:Object — The computed value being compared.
 
matcher:Matcher — An expression, built of Matchers, specifying allowed values.

See also

org.hamcrest.CoreMatchers
assumeTrue()method 
public static function assumeTrue(b:Boolean):void

If called with an expression evaluating to false, the test will halt and be ignored.

Parameters

b:Boolean — The evaluated Boolean value to check.