author | hlopkmar |
Tue, 06 Dec 2011 16:31:41 +0000 | |
branch | jk_new_structure |
changeset 1226 | bd1d5c4ca4a8 |
parent 1155 | d6f6d5fc0343 |
child 1245 | 7cf4e252749a |
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 |
||
773 | 23 |
AbstractJavaTestCase 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 |
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
|
59 |
|classRef 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
|
60 |
|
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 |
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
|
62 |
result := 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
|
63 |
expectedResult := JavaVM javaArrayClassFor: (Java classForName: 'java.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
|
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 | |
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
|
71 |
|
1021
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
877
diff
changeset
|
72 |
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
|
73 |
result := classRef resolve. |
1021
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
877
diff
changeset
|
74 |
expectedResult := JavaVM javaArrayClassFor: (JavaVM |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
877
diff
changeset
|
75 |
javaArrayClassFor: (Java classForName: 'java.lang.Object')). |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
877
diff
changeset
|
76 |
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
|
77 |
|
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 |
"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
|
79 |
! ! |
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
|
80 |
|
777 | 81 |
!JavaClassRefTests methodsFor:'permission tests'! |
761 | 82 |
|
83 |
testAccessingNonPublicFromInside |
|
84 |
| javaClassRef initString throwedException | |
|
85 |
||
86 |
self enableMockedExceptionThrowing. |
|
87 |
||
88 |
[ 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
|
89 |
javaClassRef := self getClassRefNamed: initString. |
761 | 90 |
javaClassRef owner: (Java classForName: 'stx.libjava.tests.mocks.Crate'). |
91 |
javaClassRef resolve. ] on: Error |
|
92 |
do: [:e | throwedException := e ]. |
|
771 | 93 |
self assertTrue: (throwedException isNil). |
761 | 94 |
self disableMockedExceptionThrowing. |
95 |
||
96 |
"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
|
97 |
"Modified: / 23-05-2011 / 17:58:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
761 | 98 |
! |
99 |
||
100 |
testAccessingNonPublicFromOutside |
|
101 |
| javaClassRef initString throwedException | |
|
102 |
||
103 |
self enableMockedExceptionThrowing. |
|
104 |
||
105 |
[ 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
|
106 |
javaClassRef := self getClassRefNamed: initString. |
761 | 107 |
javaClassRef owner: (Java classForName: 'java.lang.Object'). |
108 |
javaClassRef resolve. ] on: Error |
|
109 |
do: [:e | throwedException := e ]. |
|
110 |
self assertTrue: (throwedException notNil |
|
111 |
and: [ throwedException messageText = 'IllegalAccessError' ]). |
|
112 |
self disableMockedExceptionThrowing. |
|
113 |
||
114 |
"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
|
115 |
"Modified: / 23-05-2011 / 17:58:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
761 | 116 |
! |
117 |
||
118 |
testAccessingPublic |
|
119 |
| javaClassRef initString | |
|
120 |
||
121 |
self enableMockedExceptionThrowing. |
|
771 | 122 |
self shouldnt: |
123 |
[ 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
|
124 |
javaClassRef := self getClassRefNamed: initString. |
771 | 125 |
javaClassRef owner: (Java classForName: 'java.lang.Object'). |
126 |
javaClassRef resolve. ] |
|
127 |
raise: Error. |
|
761 | 128 |
self disableMockedExceptionThrowing. |
129 |
||
130 |
"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
|
131 |
"Modified: / 23-05-2011 / 17:58:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
761 | 132 |
! |
133 |
||
134 |
testNonPublicClassPresent |
|
135 |
| javaClassRef initString | |
|
136 |
||
137 |
self enableMockedExceptionThrowing. |
|
138 |
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
|
139 |
javaClassRef := self getClassRefNamed: initString. |
771 | 140 |
javaClassRef owner: (Java |
141 |
classForName: 'stx.libjava.tests.mocks.SubclassOfNonPublicClass'). |
|
761 | 142 |
javaClassRef resolve. |
143 |
self assertTrue: (javaClassRef valueCache notNil). |
|
144 |
self disableMockedExceptionThrowing. |
|
145 |
||
146 |
"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
|
147 |
"Modified: / 23-05-2011 / 17:58:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
761 | 148 |
! |
149 |
||
150 |
testPublicClassPresent |
|
151 |
| javaClassRef initString | |
|
152 |
||
153 |
self enableMockedExceptionThrowing. |
|
154 |
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
|
155 |
javaClassRef := self getClassRefNamed: initString. |
761 | 156 |
javaClassRef owner: (Java classForName: 'java.lang.Object'). |
157 |
javaClassRef resolve. |
|
158 |
self assertTrue: (javaClassRef valueCache notNil). |
|
159 |
self disableMockedExceptionThrowing. |
|
160 |
||
161 |
"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
|
162 |
"Modified: / 23-05-2011 / 17:58:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
761 | 163 |
! ! |
164 |
||
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
|
165 |
!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
|
166 |
|
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 |
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
|
168 |
| 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
|
169 |
|
1226 | 170 |
#( $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
|
171 |
[: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 |
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
|
173 |
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
|
174 |
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
|
175 |
= 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
|
176 |
|
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 |
"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
|
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 |
|
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 |
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
|
181 |
| 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
|
182 |
|
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 |
#( $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
|
184 |
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
|
185 |
[: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
|
186 |
|
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 |
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
|
188 |
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
|
189 |
|
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 |
"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
|
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 |
|
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 |
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
|
194 |
| classRef descriptor | |
1226 | 195 |
#( $B $D $F $I $J $S $Z ) do: [ |
196 |
:each | |
|
197 |
descriptor := '[[[[' , each. |
|
198 |
classRef := self getClassRefNamed: descriptor. |
|
199 |
self assertTrue: ((JavaDescriptor readFromString: descriptor) javaClass name |
|
200 |
= classRef resolve name) |
|
201 |
]. |
|
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
|
202 |
|
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 |
"Created: / 23-05-2011 / 20:50:04 / 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
|
204 |
! ! |
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
|
205 |
|
761 | 206 |
!JavaClassRefTests methodsFor:'resolving static tests'! |
207 |
||
208 |
testCorrectStaticResolving |
|
209 |
| javaClassRef initString result expectedResult | |
|
210 |
||
211 |
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
|
212 |
javaClassRef := self getClassRefNamed: initString. |
771 | 213 |
javaClassRef |
214 |
owner: (Java classForName: 'stx.libjava.tests.mocks.ClassWithInnerClasses'). |
|
761 | 215 |
expectedResult := Java |
216 |
classForName: 'stx.libjava.tests.mocks.ClassWithInnerClasses$InnerStatic'. |
|
217 |
result := javaClassRef resolveStatic. |
|
218 |
self assertTrue: (result = expectedResult). |
|
219 |
||
220 |
"Created: / 28-04-2011 / 21:51:26 / 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
|
221 |
"Modified: / 23-05-2011 / 17:58:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
761 | 222 |
! ! |
223 |
||
224 |
!JavaClassRefTests methodsFor:'resolving tests'! |
|
758 | 225 |
|
226 |
testCorrectInstanceCreation |
|
771 | 227 |
| javaClassRef initString | |
758 | 228 |
|
771 | 229 |
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
|
230 |
javaClassRef := self getClassRefNamed: initString. |
771 | 231 |
self assertFalse: (javaClassRef isResolved). |
232 |
self assertTrue: (javaClassRef valueCache isNil). |
|
233 |
self assertTrue: (javaClassRef name = initString). |
|
758 | 234 |
|
235 |
"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
|
236 |
"Modified: / 23-05-2011 / 17:58:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 237 |
! |
238 |
||
239 |
testCorrectResolving |
|
761 | 240 |
| javaClassRef initString result expectedResult | |
758 | 241 |
|
242 |
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
|
243 |
javaClassRef := self getClassRefNamed: initString. |
761 | 244 |
javaClassRef owner: (Java classForName: 'java.lang.Object'). |
245 |
expectedResult := Java classForName: 'java.lang.String'. |
|
758 | 246 |
result := javaClassRef resolve. |
247 |
self assertTrue: (result = expectedResult). |
|
248 |
||
249 |
"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
|
250 |
"Modified: / 23-05-2011 / 17:58:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 251 |
! |
252 |
||
253 |
testInvalidation |
|
254 |
| javaClassRef initString | |
|
255 |
||
256 |
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
|
257 |
javaClassRef := self getClassRefNamed: initString. |
761 | 258 |
javaClassRef owner: (Java classForName: 'java.lang.Object'). |
758 | 259 |
self assertTrue: (javaClassRef isResolved not). |
260 |
javaClassRef resolve. |
|
261 |
self assertTrue: (javaClassRef isResolved). |
|
262 |
javaClassRef invalidate. |
|
263 |
self assertTrue: (javaClassRef isResolved not). |
|
264 |
||
265 |
"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
|
266 |
"Modified: / 23-05-2011 / 17:58:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 267 |
! |
268 |
||
269 |
testInvalidationForClassNegative |
|
270 |
| javaClassRef initString | |
|
271 |
||
771 | 272 |
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
|
273 |
javaClassRef := self getClassRefNamed: initString. |
761 | 274 |
javaClassRef owner: (Java classForName: 'java.lang.Object'). |
758 | 275 |
self assertTrue: (javaClassRef isResolved not). |
276 |
javaClassRef resolve. |
|
277 |
self assertTrue: (javaClassRef isResolved). |
|
761 | 278 |
javaClassRef invalidateForClass: 'Ljava/lang/Object;'. |
758 | 279 |
self assertTrue: (javaClassRef isResolved). |
280 |
||
281 |
"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
|
282 |
"Modified: / 23-05-2011 / 17:58:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 283 |
! |
284 |
||
285 |
testInvalidationForClassPositive |
|
286 |
| javaClassRef initString | |
|
287 |
||
288 |
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
|
289 |
javaClassRef := self getClassRefNamed: initString. |
761 | 290 |
javaClassRef owner: (Java classForName: 'java.lang.Object'). |
758 | 291 |
self assertTrue: (javaClassRef isResolved not). |
292 |
javaClassRef resolve. |
|
293 |
self assertTrue: (javaClassRef isResolved). |
|
761 | 294 |
javaClassRef invalidateForClass: initString. |
758 | 295 |
self assertTrue: (javaClassRef isResolved not). |
296 |
||
297 |
"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
|
298 |
"Modified: / 23-05-2011 / 17:57:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 299 |
! |
300 |
||
301 |
testResolving |
|
761 | 302 |
| javaClassRef initString | |
758 | 303 |
|
761 | 304 |
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
|
305 |
javaClassRef := self getClassRefNamed: initString. |
761 | 306 |
javaClassRef owner: (Java classForName: 'java.lang.Object'). |
307 |
self assertTrue: (javaClassRef isResolved not). |
|
308 |
javaClassRef resolve. |
|
309 |
self assertTrue: (javaClassRef isResolved). |
|
758 | 310 |
|
311 |
"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
|
312 |
"Modified: / 23-05-2011 / 17:57:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 313 |
! ! |
314 |
||
315 |
!JavaClassRefTests class methodsFor:'documentation'! |
|
316 |
||
317 |
version_SVN |
|
318 |
^ '$Id$' |
|
319 |
! ! |