749
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger
|
|
3 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
|
|
4 |
SWING Research Group, Czech Technical University in Prague
|
|
5 |
|
|
6 |
Parts of the code written by Claus Gittinger are under following
|
|
7 |
license:
|
|
8 |
|
|
9 |
This software is furnished under a license and may be used
|
|
10 |
only in accordance with the terms of that license and with the
|
|
11 |
inclusion of the above copyright notice. This software may not
|
|
12 |
be provided or otherwise made available to, or used by, any
|
|
13 |
other person. No title to or ownership of the software is
|
|
14 |
hereby transferred.
|
|
15 |
|
|
16 |
Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
|
|
17 |
|
|
18 |
Permission is hereby granted, free of charge, to any person
|
|
19 |
obtaining a copy of this software and associated documentation
|
|
20 |
files (the 'Software'), to deal in the Software without
|
|
21 |
restriction, including without limitation the rights to use,
|
|
22 |
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
23 |
copies of the Software, and to permit persons to whom the
|
|
24 |
Software is furnished to do so, subject to the following
|
|
25 |
conditions:
|
|
26 |
|
|
27 |
The above copyright notice and this permission notice shall be
|
|
28 |
included in all copies or substantial portions of the Software.
|
|
29 |
|
|
30 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
31 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
32 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
33 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
34 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
35 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
36 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
37 |
OTHER DEALINGS IN THE SOFTWARE.
|
|
38 |
|
|
39 |
[1] Code written at SWING Research Group contain a signature
|
|
40 |
of one of the above copright owners.
|
|
41 |
"
|
|
42 |
"{ Package: 'stx:libjava' }"
|
|
43 |
|
|
44 |
JavaTestCaseProxy subclass:#JUnitTestCaseProxy
|
|
45 |
instanceVariableNames:''
|
|
46 |
classVariableNames:''
|
|
47 |
poolDictionaries:''
|
|
48 |
category:'Languages-Java-Tests-Proxies'
|
|
49 |
!
|
|
50 |
|
|
51 |
!JUnitTestCaseProxy class methodsFor:'documentation'!
|
|
52 |
|
|
53 |
copyright
|
|
54 |
"
|
|
55 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger
|
|
56 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
|
|
57 |
SWING Research Group, Czech Technical University in Prague
|
|
58 |
|
|
59 |
Parts of the code written by Claus Gittinger are under following
|
|
60 |
license:
|
|
61 |
|
|
62 |
This software is furnished under a license and may be used
|
|
63 |
only in accordance with the terms of that license and with the
|
|
64 |
inclusion of the above copyright notice. This software may not
|
|
65 |
be provided or otherwise made available to, or used by, any
|
|
66 |
other person. No title to or ownership of the software is
|
|
67 |
hereby transferred.
|
|
68 |
|
|
69 |
Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
|
|
70 |
|
|
71 |
Permission is hereby granted, free of charge, to any person
|
|
72 |
obtaining a copy of this software and associated documentation
|
|
73 |
files (the 'Software'), to deal in the Software without
|
|
74 |
restriction, including without limitation the rights to use,
|
|
75 |
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
76 |
copies of the Software, and to permit persons to whom the
|
|
77 |
Software is furnished to do so, subject to the following
|
|
78 |
conditions:
|
|
79 |
|
|
80 |
The above copyright notice and this permission notice shall be
|
|
81 |
included in all copies or substantial portions of the Software.
|
|
82 |
|
|
83 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
84 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
85 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
86 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
87 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
88 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
89 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
90 |
OTHER DEALINGS IN THE SOFTWARE.
|
|
91 |
|
|
92 |
[1] Code written at SWING Research Group contain a signature
|
|
93 |
of one of the above copright owners.
|
|
94 |
|
|
95 |
"
|
|
96 |
! !
|
|
97 |
|
|
98 |
!JUnitTestCaseProxy class methodsFor:'initialization'!
|
|
99 |
|
|
100 |
initialize
|
|
101 |
|
|
102 |
TestCases := Dictionary new.
|
|
103 |
|
|
104 |
"Created: / 01-03-2011 / 10:43:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
105 |
! !
|
|
106 |
|
|
107 |
!JUnitTestCaseProxy class methodsFor:'accessing'!
|
|
108 |
|
|
109 |
lookupHierarchyRoot
|
|
110 |
|
|
111 |
^JUnitTestCaseProxy
|
|
112 |
|
|
113 |
"Created: / 01-03-2011 / 11:41:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
114 |
"Modified: / 01-03-2011 / 14:54:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
115 |
! !
|
|
116 |
|
|
117 |
!JUnitTestCaseProxy class methodsFor:'private'!
|
|
118 |
|
|
119 |
testSelectors
|
|
120 |
| javaClass |
|
|
121 |
|
|
122 |
self == JUnitTestCaseProxy ifTrue:[ ^ #() ].
|
|
123 |
javaClass := self javaClass.
|
|
124 |
(javaClass includesBehavior:(JavaVM classForName:'junit.framework.TestCase'))
|
|
125 |
ifTrue:[ ^ javaClass selectors select:[:sel | sel startsWith:'test' ]. ].
|
|
126 |
|
|
127 |
^ (javaClass
|
|
128 |
selectMethodsAnnotatedWith:(JavaVM classForName:'org.junit.Test') typeName)
|
|
129 |
collect:[:method | method selector ]
|
|
130 |
|
|
131 |
"
|
|
132 |
(JUnitTestCase for: JAVA::stx::libjava::tests::junit::JUnit3Tests)
|
|
133 |
testSelectors"
|
|
134 |
|
|
135 |
"Created: / 01-03-2011 / 10:49:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
136 |
"Modified: / 03-03-2011 / 00:34:39 / Marcel Hlopko <hlopik@gmail.com>"
|
|
137 |
"Modified: / 04-03-2011 / 00:05:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
138 |
! !
|
|
139 |
|
|
140 |
!JUnitTestCaseProxy class methodsFor:'subclass creation'!
|
|
141 |
|
|
142 |
for:javaClass
|
|
143 |
"Answers a new (anonymous) testcase proxy for
|
|
144 |
given javaClass"
|
|
145 |
|
|
146 |
self assert:javaClass isJavaClass description:'Not a java class'.
|
|
147 |
self assert:javaClass isTestCaseLike
|
|
148 |
description:'Not a testcase-like class'.
|
|
149 |
^self forClassNamed: javaClass name
|
|
150 |
|
|
151 |
"Created: / 01-03-2011 / 10:30:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
152 |
"Modified: / 03-03-2011 / 00:20:49 / Marcel Hlopko <hlopik@gmail.com>"
|
|
153 |
"Modified: / 21-06-2011 / 17:08:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
154 |
! !
|
|
155 |
|
|
156 |
!JUnitTestCaseProxy methodsFor:'accessing'!
|
|
157 |
|
|
158 |
nameForHDTestReport
|
|
159 |
|
|
160 |
^self class javaClassName copyReplaceAll:$/ with: $.
|
|
161 |
|
|
162 |
"Created: / 01-04-2011 / 16:10:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
163 |
|
|
164 |
!
|
|
165 |
|
|
166 |
selectorForHDTestReport
|
|
167 |
|
|
168 |
^testSelector upTo:$(
|
|
169 |
|
|
170 |
! !
|
|
171 |
|
|
172 |
!JUnitTestCaseProxy methodsFor:'private'!
|
|
173 |
|
|
174 |
performTest
|
|
175 |
|
|
176 |
<resource: #skipInDebuggersWalkBack>
|
|
177 |
|
|
178 |
[
|
|
179 |
self javaClass new perform: testSelector sunitAsSymbol
|
|
180 |
] on: JavaError do: [:ex|
|
|
181 |
"This is the tricky part. We have to auto-magically convert
|
|
182 |
jUnit's AssertionFailedError to sUnits TestFailure's"
|
|
183 |
|
|
184 |
"Bad, bad, I know..."
|
|
185 |
(ex parameter class name == #'junit/framework/AssertionFailedError')
|
|
186 |
ifTrue:
|
|
187 |
[ TestResult failure sunitSignalWith: ex description ]
|
|
188 |
ifFalse:
|
|
189 |
[ ex pass ]
|
|
190 |
]
|
|
191 |
|
|
192 |
"Created: / 01-03-2011 / 14:50:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
193 |
"Modified: / 04-03-2011 / 00:07:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
194 |
! !
|
|
195 |
|
|
196 |
!JUnitTestCaseProxy class methodsFor:'documentation'!
|
|
197 |
|
|
198 |
version_SVN
|
|
199 |
^ '$Id$'
|
|
200 |
! !
|
|
201 |
|
|
202 |
JUnitTestCaseProxy initialize! |