Mercurial > hg > audiodb
annotate bindings/as3/ext/asunit/framework/TestFailure.as @ 770:c54bc2ffbf92 tip
update tags
author | convert-repo |
---|---|
date | Fri, 16 Dec 2011 11:34:01 +0000 |
parents | 3a0b9700b3d2 |
children |
rev | line source |
---|---|
mas01mj@732 | 1 package asunit.framework { |
mas01mj@732 | 2 import asunit.errors.AssertionFailedError; |
mas01mj@732 | 3 |
mas01mj@732 | 4 /** |
mas01mj@732 | 5 * A <code>TestFailure</code> collects a failed test together with |
mas01mj@732 | 6 * the caught exception. |
mas01mj@732 | 7 * @see TestResult |
mas01mj@732 | 8 */ |
mas01mj@732 | 9 public class TestFailure { |
mas01mj@732 | 10 protected var fFailedTest:Test; |
mas01mj@732 | 11 protected var fFailedTestMethod:String; |
mas01mj@732 | 12 protected var fThrownException:Error; |
mas01mj@732 | 13 |
mas01mj@732 | 14 /** |
mas01mj@732 | 15 * Constructs a TestFailure with the given test and exception. |
mas01mj@732 | 16 */ |
mas01mj@732 | 17 public function TestFailure(failedTest:Test, thrownException:Error) { |
mas01mj@732 | 18 fFailedTest = failedTest; |
mas01mj@732 | 19 fFailedTestMethod = failedTest.getCurrentMethod(); |
mas01mj@732 | 20 fThrownException = thrownException; |
mas01mj@732 | 21 } |
mas01mj@732 | 22 |
mas01mj@732 | 23 public function failedFeature():String { |
mas01mj@732 | 24 return failedTest().getName() + '.' + fFailedTestMethod; |
mas01mj@732 | 25 } |
mas01mj@732 | 26 |
mas01mj@732 | 27 public function failedMethod():String { |
mas01mj@732 | 28 return fFailedTestMethod; |
mas01mj@732 | 29 } |
mas01mj@732 | 30 |
mas01mj@732 | 31 /** |
mas01mj@732 | 32 * Gets the failed test case. |
mas01mj@732 | 33 */ |
mas01mj@732 | 34 public function failedTest():Test { |
mas01mj@732 | 35 return fFailedTest; |
mas01mj@732 | 36 } |
mas01mj@732 | 37 /** |
mas01mj@732 | 38 * Gets the thrown exception. |
mas01mj@732 | 39 */ |
mas01mj@732 | 40 public function thrownException():Error { |
mas01mj@732 | 41 return fThrownException; |
mas01mj@732 | 42 } |
mas01mj@732 | 43 /** |
mas01mj@732 | 44 * Returns a short description of the failure. |
mas01mj@732 | 45 */ |
mas01mj@732 | 46 public function toString():String { |
mas01mj@732 | 47 return ""; |
mas01mj@732 | 48 } |
mas01mj@732 | 49 |
mas01mj@732 | 50 public function exceptionMessage():String { |
mas01mj@732 | 51 return thrownException().message; |
mas01mj@732 | 52 } |
mas01mj@732 | 53 |
mas01mj@732 | 54 public function isFailure():Boolean { |
mas01mj@732 | 55 return thrownException() is AssertionFailedError; |
mas01mj@732 | 56 } |
mas01mj@732 | 57 } |
mas01mj@732 | 58 } |