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