author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Fri, 25 Jan 2013 00:15:51 +0000 | |
branch | refactoring-classpath |
changeset 2000 | 13a10b73aa83 |
parent 1953 | 1e42ad3fc322 |
child 2069 | 75d40b7b986f |
permissions | -rw-r--r-- |
877 | 1 |
" |
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
1152 | 3 |
|
1155 | 4 |
New code and modifications done at SWING Research Group [1]: |
1152 | 5 |
|
877 | 6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
7 |
SWING Research Group, Czech Technical University in Prague |
|
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 |
||
1155 | 16 |
[1] Code written at SWING Research Group contains a signature |
17 |
of one of the above copright owners. For exact set of such code, |
|
18 |
see the differences between this version and version stx:libjava |
|
1152 | 19 |
as of 1.9.2010 |
877 | 20 |
" |
758 | 21 |
"{ Package: 'stx:libjava' }" |
22 |
||
1515 | 23 |
JavaRefsAndConstantPoolTestCase subclass:#JavaClassRefTests |
758 | 24 |
instanceVariableNames:'' |
25 |
classVariableNames:'' |
|
26 |
poolDictionaries:'' |
|
27 |
category:'Languages-Java-Tests-RuntimeConstantPool' |
|
28 |
! |
|
29 |
||
877 | 30 |
!JavaClassRefTests class methodsFor:'documentation'! |
31 |
||
32 |
copyright |
|
33 |
" |
|
34 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
1152 | 35 |
|
1155 | 36 |
New code and modifications done at SWING Research Group [1]: |
1152 | 37 |
|
877 | 38 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
39 |
SWING Research Group, Czech Technical University in Prague |
|
40 |
||
41 |
This software is furnished under a license and may be used |
|
42 |
only in accordance with the terms of that license and with the |
|
43 |
inclusion of the above copyright notice. This software may not |
|
44 |
be provided or otherwise made available to, or used by, any |
|
45 |
other person. No title to or ownership of the software is |
|
46 |
hereby transferred. |
|
47 |
||
1155 | 48 |
[1] Code written at SWING Research Group contains a signature |
49 |
of one of the above copright owners. For exact set of such code, |
|
50 |
see the differences between this version and version stx:libjava |
|
1152 | 51 |
as of 1.9.2010 |
877 | 52 |
|
53 |
" |
|
54 |
! ! |
|
758 | 55 |
|
817
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
56 |
!JavaClassRefTests methodsFor:'arrays'! |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
57 |
|
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
58 |
testCorrectArrayCreation |
1532 | 59 |
| classRef result expectedResult | |
817
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
60 |
classRef := self getClassRefNamed: '[Ljava/lang/Object;'. |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
61 |
result := classRef resolve. |
1532 | 62 |
expectedResult := JavaArray |
63 |
javaArrayClassFor: (Java classForName: 'java.lang.Object'). |
|
817
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
64 |
self assertTrue: (result = expectedResult). |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
65 |
|
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
66 |
"Created: / 23-05-2011 / 21:15:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
67 |
! |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
68 |
|
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
69 |
testCorrectMultiArrayCreation |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
70 |
| classRef result expectedResult | |
1021
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
877
diff
changeset
|
71 |
classRef := self getClassRefNamed: '[[Ljava/lang/Object;'. |
817
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
72 |
result := classRef resolve. |
1532 | 73 |
expectedResult := JavaArray javaArrayClassFor: (JavaArray |
74 |
javaArrayClassFor: (Java classForName: 'java.lang.Object')). |
|
1021
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
877
diff
changeset
|
75 |
self assertTrue: (result name = expectedResult name). |
817
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
76 |
|
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
77 |
"Created: / 23-05-2011 / 21:15:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
78 |
! ! |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
79 |
|
777 | 80 |
!JavaClassRefTests methodsFor:'permission tests'! |
761 | 81 |
|
82 |
testAccessingNonPublicFromInside |
|
83 |
| javaClassRef initString throwedException | |
|
84 |
||
85 |
self enableMockedExceptionThrowing. |
|
86 |
||
87 |
[ initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'. |
|
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
777
diff
changeset
|
88 |
javaClassRef := self getClassRefNamed: initString. |
761 | 89 |
javaClassRef owner: (Java classForName: 'stx.libjava.tests.mocks.Crate'). |
90 |
javaClassRef resolve. ] on: Error |
|
91 |
do: [:e | throwedException := e ]. |
|
771 | 92 |
self assertTrue: (throwedException isNil). |
761 | 93 |
self disableMockedExceptionThrowing. |
94 |
||
95 |
"Created: / 13-04-2011 / 13:42:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
777
diff
changeset
|
96 |
"Modified: / 23-05-2011 / 17:58:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
761 | 97 |
! |
98 |
||
99 |
testAccessingNonPublicFromOutside |
|
100 |
| javaClassRef initString throwedException | |
|
101 |
||
102 |
self enableMockedExceptionThrowing. |
|
103 |
||
104 |
[ initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'. |
|
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
777
diff
changeset
|
105 |
javaClassRef := self getClassRefNamed: initString. |
761 | 106 |
javaClassRef owner: (Java classForName: 'java.lang.Object'). |
107 |
javaClassRef resolve. ] on: Error |
|
108 |
do: [:e | throwedException := e ]. |
|
109 |
self assertTrue: (throwedException notNil |
|
110 |
and: [ throwedException messageText = 'IllegalAccessError' ]). |
|
111 |
self disableMockedExceptionThrowing. |
|
112 |
||
113 |
"Created: / 13-04-2011 / 13:37:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
777
diff
changeset
|
114 |
"Modified: / 23-05-2011 / 17:58:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
761 | 115 |
! |
116 |
||
117 |
testAccessingPublic |
|
118 |
| javaClassRef initString | |
|
119 |
||
120 |
self enableMockedExceptionThrowing. |
|
771 | 121 |
self shouldnt: |
122 |
[ initString := 'Lstx/libjava/tests/mocks/PublicClass;'. |
|
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
777
diff
changeset
|
123 |
javaClassRef := self getClassRefNamed: initString. |
771 | 124 |
javaClassRef owner: (Java classForName: 'java.lang.Object'). |
125 |
javaClassRef resolve. ] |
|
126 |
raise: Error. |
|
761 | 127 |
self disableMockedExceptionThrowing. |
128 |
||
129 |
"Created: / 13-04-2011 / 13:36:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
777
diff
changeset
|
130 |
"Modified: / 23-05-2011 / 17:58:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
761 | 131 |
! |
132 |
||
133 |
testNonPublicClassPresent |
|
134 |
| javaClassRef initString | |
|
135 |
||
136 |
self enableMockedExceptionThrowing. |
|
137 |
initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'. |
|
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
777
diff
changeset
|
138 |
javaClassRef := self getClassRefNamed: initString. |
771 | 139 |
javaClassRef owner: (Java |
140 |
classForName: 'stx.libjava.tests.mocks.SubclassOfNonPublicClass'). |
|
761 | 141 |
javaClassRef resolve. |
142 |
self assertTrue: (javaClassRef valueCache notNil). |
|
143 |
self disableMockedExceptionThrowing. |
|
144 |
||
145 |
"Created: / 13-04-2011 / 13:38:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
777
diff
changeset
|
146 |
"Modified: / 23-05-2011 / 17:58:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
761 | 147 |
! |
148 |
||
149 |
testPublicClassPresent |
|
150 |
| javaClassRef initString | |
|
151 |
||
152 |
self enableMockedExceptionThrowing. |
|
153 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'. |
|
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
777
diff
changeset
|
154 |
javaClassRef := self getClassRefNamed: initString. |
761 | 155 |
javaClassRef owner: (Java classForName: 'java.lang.Object'). |
156 |
javaClassRef resolve. |
|
157 |
self assertTrue: (javaClassRef valueCache notNil). |
|
158 |
self disableMockedExceptionThrowing. |
|
159 |
||
160 |
"Created: / 13-04-2011 / 13:39:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
777
diff
changeset
|
161 |
"Modified: / 23-05-2011 / 17:58:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
761 | 162 |
! ! |
163 |
||
817
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
164 |
!JavaClassRefTests methodsFor:'primitives'! |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
165 |
|
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
166 |
testAllPrimitiveArrayClasses |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
167 |
| classRef descriptor | |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
168 |
|
1226 | 169 |
#( $B $D $F $I $J $S $Z ) do: |
817
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
170 |
[:each | |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
171 |
descriptor := '[' , each. |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
172 |
classRef := self getClassRefNamed: descriptor. |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
173 |
self assertTrue: ((JavaDescriptor readFromString: descriptor) javaClass |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
174 |
= classRef resolve) ]. |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
175 |
|
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
176 |
"Created: / 23-05-2011 / 20:49:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
177 |
! |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
178 |
|
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
179 |
testAllPrimitiveClasses |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
180 |
| classRef | |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
181 |
|
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
182 |
#( $B $C $D $F $I $J $S $Z ) |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
183 |
do: |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
184 |
[:each | |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
185 |
|
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
186 |
classRef := self getClassRefNamed: each asString. |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
187 |
self assertTrue: ((JavaDescriptor baseTypes at: each) = classRef resolve) ]. |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
188 |
|
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
189 |
"Created: / 23-05-2011 / 20:48:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
190 |
! |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
191 |
|
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
192 |
testAllPrimitiveMultiArrayClasses |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
193 |
| classRef descriptor | |
1226 | 194 |
#( $B $D $F $I $J $S $Z ) do: [ |
195 |
:each | |
|
196 |
descriptor := '[[[[' , each. |
|
197 |
classRef := self getClassRefNamed: descriptor. |
|
1828 | 198 |
self assertTrue: ((JavaDescriptor readFromString: descriptor) match: classRef resolve). |
1226 | 199 |
]. |
817
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
200 |
|
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
201 |
"Created: / 23-05-2011 / 20:50:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1828 | 202 |
"Modified: / 17-11-2012 / 21:40:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
817
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
203 |
! ! |
3f2405c6ef88
its nice to work after jv :) after writing tests I surprisedly realized, that he already implemented primitives and primitive arrays in JavaClassRef2 :)
hlopkmar
parents:
816
diff
changeset
|
204 |
|
761 | 205 |
!JavaClassRefTests methodsFor:'resolving static tests'! |
206 |
||
207 |
testCorrectStaticResolving |
|
208 |
| javaClassRef initString result expectedResult | |
|
209 |
initString := 'Lstx/libjava/tests/mocks/ClassWithInnerClasses$InnerStatic;'. |
|
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
777
diff
changeset
|
210 |
javaClassRef := self getClassRefNamed: initString. |
771 | 211 |
javaClassRef |
212 |
owner: (Java classForName: 'stx.libjava.tests.mocks.ClassWithInnerClasses'). |
|
761 | 213 |
expectedResult := Java |
214 |
classForName: 'stx.libjava.tests.mocks.ClassWithInnerClasses$InnerStatic'. |
|
1245 | 215 |
result := javaClassRef resolve. |
761 | 216 |
self assertTrue: (result = expectedResult). |
217 |
||
218 |
"Created: / 28-04-2011 / 21:51:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1245 | 219 |
"Modified: / 08-12-2011 / 19:24:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
761 | 220 |
! ! |
221 |
||
222 |
!JavaClassRefTests methodsFor:'resolving tests'! |
|
758 | 223 |
|
224 |
testCorrectInstanceCreation |
|
771 | 225 |
| javaClassRef initString | |
758 | 226 |
|
771 | 227 |
initString := 'Ljava/lang/String;'. |
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
777
diff
changeset
|
228 |
javaClassRef := self getClassRefNamed: initString. |
771 | 229 |
self assertFalse: (javaClassRef isResolved). |
230 |
self assertTrue: (javaClassRef valueCache isNil). |
|
231 |
self assertTrue: (javaClassRef name = initString). |
|
758 | 232 |
|
233 |
"Created: / 08-04-2011 / 14:01:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
777
diff
changeset
|
234 |
"Modified: / 23-05-2011 / 17:58:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 235 |
! |
236 |
||
237 |
testCorrectResolving |
|
761 | 238 |
| javaClassRef initString result expectedResult | |
758 | 239 |
|
240 |
initString := 'Ljava/lang/String;'. |
|
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
777
diff
changeset
|
241 |
javaClassRef := self getClassRefNamed: initString. |
761 | 242 |
javaClassRef owner: (Java classForName: 'java.lang.Object'). |
243 |
expectedResult := Java classForName: 'java.lang.String'. |
|
758 | 244 |
result := javaClassRef resolve. |
245 |
self assertTrue: (result = expectedResult). |
|
246 |
||
247 |
"Created: / 08-04-2011 / 14:07:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
777
diff
changeset
|
248 |
"Modified: / 23-05-2011 / 17:58:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 249 |
! |
250 |
||
251 |
testInvalidation |
|
252 |
| javaClassRef initString | |
|
253 |
||
254 |
initString := 'Ljava/lang/String;'. |
|
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
777
diff
changeset
|
255 |
javaClassRef := self getClassRefNamed: initString. |
761 | 256 |
javaClassRef owner: (Java classForName: 'java.lang.Object'). |
758 | 257 |
self assertTrue: (javaClassRef isResolved not). |
258 |
javaClassRef resolve. |
|
259 |
self assertTrue: (javaClassRef isResolved). |
|
260 |
javaClassRef invalidate. |
|
261 |
self assertTrue: (javaClassRef isResolved not). |
|
262 |
||
263 |
"Created: / 08-04-2011 / 14:09:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
777
diff
changeset
|
264 |
"Modified: / 23-05-2011 / 17:58:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 265 |
! |
266 |
||
267 |
testInvalidationForClassNegative |
|
268 |
| javaClassRef initString | |
|
269 |
||
771 | 270 |
initString := 'Ljava/lang/String;'. |
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
777
diff
changeset
|
271 |
javaClassRef := self getClassRefNamed: initString. |
761 | 272 |
javaClassRef owner: (Java classForName: 'java.lang.Object'). |
758 | 273 |
self assertTrue: (javaClassRef isResolved not). |
274 |
javaClassRef resolve. |
|
275 |
self assertTrue: (javaClassRef isResolved). |
|
761 | 276 |
javaClassRef invalidateForClass: 'Ljava/lang/Object;'. |
758 | 277 |
self assertTrue: (javaClassRef isResolved). |
278 |
||
279 |
"Created: / 08-04-2011 / 16:21:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
777
diff
changeset
|
280 |
"Modified: / 23-05-2011 / 17:58:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 281 |
! |
282 |
||
283 |
testInvalidationForClassPositive |
|
284 |
| javaClassRef initString | |
|
285 |
||
286 |
initString := 'Ljava/lang/String;'. |
|
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
777
diff
changeset
|
287 |
javaClassRef := self getClassRefNamed: initString. |
761 | 288 |
javaClassRef owner: (Java classForName: 'java.lang.Object'). |
758 | 289 |
self assertTrue: (javaClassRef isResolved not). |
290 |
javaClassRef resolve. |
|
291 |
self assertTrue: (javaClassRef isResolved). |
|
761 | 292 |
javaClassRef invalidateForClass: initString. |
758 | 293 |
self assertTrue: (javaClassRef isResolved not). |
294 |
||
295 |
"Created: / 08-04-2011 / 16:21:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
777
diff
changeset
|
296 |
"Modified: / 23-05-2011 / 17:57:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 297 |
! |
298 |
||
299 |
testResolving |
|
761 | 300 |
| javaClassRef initString | |
758 | 301 |
|
761 | 302 |
initString := 'Ljava/lang/String;'. |
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
777
diff
changeset
|
303 |
javaClassRef := self getClassRefNamed: initString. |
761 | 304 |
javaClassRef owner: (Java classForName: 'java.lang.Object'). |
305 |
self assertTrue: (javaClassRef isResolved not). |
|
306 |
javaClassRef resolve. |
|
307 |
self assertTrue: (javaClassRef isResolved). |
|
758 | 308 |
|
309 |
"Created: / 08-04-2011 / 14:04:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
777
diff
changeset
|
310 |
"Modified: / 23-05-2011 / 17:57:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 311 |
! ! |
312 |
||
313 |
!JavaClassRefTests class methodsFor:'documentation'! |
|
314 |
||
1953
1e42ad3fc322
Added support Java>>addToClassPath: & Java>>addToSourcePath:. Removed JavaPathElement.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1828
diff
changeset
|
315 |
version_HG |
1e42ad3fc322
Added support Java>>addToClassPath: & Java>>addToSourcePath:. Removed JavaPathElement.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1828
diff
changeset
|
316 |
|
1e42ad3fc322
Added support Java>>addToClassPath: & Java>>addToSourcePath:. Removed JavaPathElement.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1828
diff
changeset
|
317 |
^ '$Changeset: <not expanded> $' |
1e42ad3fc322
Added support Java>>addToClassPath: & Java>>addToSourcePath:. Removed JavaPathElement.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1828
diff
changeset
|
318 |
! |
1e42ad3fc322
Added support Java>>addToClassPath: & Java>>addToSourcePath:. Removed JavaPathElement.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1828
diff
changeset
|
319 |
|
758 | 320 |
version_SVN |
1953
1e42ad3fc322
Added support Java>>addToClassPath: & Java>>addToSourcePath:. Removed JavaPathElement.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1828
diff
changeset
|
321 |
^ '§Id§' |
758 | 322 |
! ! |