src/TestletTestCaseProxy.st
branchjk_new_structure
changeset 826 db53b9c842d7
parent 824 26e719a7e88c
child 853 aa9af509e506
--- a/src/TestletTestCaseProxy.st	Tue May 31 14:02:06 2011 +0000
+++ b/src/TestletTestCaseProxy.st	Tue May 31 15:57:03 2011 +0000
@@ -1,7 +1,7 @@
 "{ Package: 'stx:libjava' }"
 
 TestCase subclass:#TestletTestCaseProxy
-	instanceVariableNames:''
+	instanceVariableNames:'harness'
 	classVariableNames:'TestCases'
 	poolDictionaries:''
 	category:'Languages-Java-JUnit'
@@ -147,6 +147,24 @@
     "Created: / 01-03-2011 / 14:48:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!TestletTestCaseProxy methodsFor:'error handling'!
+
+doesNotUnderstand: aMessage
+
+    aMessage selector == #'check(Z)V' ifTrue: [
+        aMessage arg1 == 0 ifTrue:
+            [TestResult failure sunitSignalWith: 'Testlet failed']
+    ] ifFalse:[ aMessage selector == #'check(ZLjava/lang/String;)V' ifTrue:[
+        aMessage arg1 == 0 ifTrue:        
+            [TestResult failure sunitSignalWith: (Java as_ST_String: aMessage arguments second)]
+    ]].
+    (harness respondsTo: aMessage selector) ifTrue:
+        [^aMessage sendTo: harness].
+    ^super doesNotUnderstand: aMessage
+
+    "Created: / 31-05-2011 / 16:30:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !TestletTestCaseProxy methodsFor:'private'!
 
 harnessMock
@@ -156,11 +174,11 @@
 !
 
 performTest
-    | harnessMock handlerBlock |
+    | handlerBlock |
 
     handlerBlock := [:ex | TestResult failure sunitSignalWith: ex description].
 
-    harnessMock := self harnessMock.
+    harness := self harnessMock.
     
     [ JavaVM unimplementedNativeMethodSignal 
         handle:
@@ -168,17 +186,17 @@
         do: [
             self javaClass new 
                 perform: 'test(Lgnu/testlet/TestHarness;)V' sunitAsSymbol
-                with: harnessMock
+                with: self
        ].
     ] on: JavaError do: [:ex | 
         TestResult failure sunitSignalWith: ex description
     ].
 
-    ((harnessMock instVarNamed: 'passed') = 0 ) ifTrue: [ TestResult failure sunitSignalWith: 'Test failed' ].
+    "/((harness instVarNamed: 'passed') = 0 ) ifTrue: [ TestResult failure sunitSignalWith: 'Test failed' ].
 
     "Created: / 01-03-2011 / 14:50:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 29-05-2011 / 23:19:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-    "Modified: / 31-05-2011 / 10:07:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 31-05-2011 / 16:28:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !TestletTestCaseProxy class methodsFor:'documentation'!