author | vranyj1 |
Fri, 06 Jul 2012 20:58:09 +0000 | |
branch | jk_new_structure |
changeset 1515 | f4ebf5cf3f89 |
parent 1245 | 7cf4e252749a |
child 1532 | ae63ecbd509e |
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 |
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 |
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
|
211 |
javaClassRef := self getClassRefNamed: initString. |
771 | 212 |
javaClassRef |
213 |
owner: (Java classForName: 'stx.libjava.tests.mocks.ClassWithInnerClasses'). |
|
761 | 214 |
expectedResult := Java |
215 |
classForName: 'stx.libjava.tests.mocks.ClassWithInnerClasses$InnerStatic'. |
|
1245 | 216 |
result := javaClassRef resolve. |
761 | 217 |
self assertTrue: (result = expectedResult). |
218 |
||
219 |
"Created: / 28-04-2011 / 21:51:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1245 | 220 |
"Modified: / 08-12-2011 / 19:24:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
761 | 221 |
! ! |
222 |
||
223 |
!JavaClassRefTests methodsFor:'resolving tests'! |
|
758 | 224 |
|
225 |
testCorrectInstanceCreation |
|
771 | 226 |
| javaClassRef initString | |
758 | 227 |
|
771 | 228 |
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
|
229 |
javaClassRef := self getClassRefNamed: initString. |
771 | 230 |
self assertFalse: (javaClassRef isResolved). |
231 |
self assertTrue: (javaClassRef valueCache isNil). |
|
232 |
self assertTrue: (javaClassRef name = initString). |
|
758 | 233 |
|
234 |
"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
|
235 |
"Modified: / 23-05-2011 / 17:58:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 236 |
! |
237 |
||
238 |
testCorrectResolving |
|
761 | 239 |
| javaClassRef initString result expectedResult | |
758 | 240 |
|
241 |
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
|
242 |
javaClassRef := self getClassRefNamed: initString. |
761 | 243 |
javaClassRef owner: (Java classForName: 'java.lang.Object'). |
244 |
expectedResult := Java classForName: 'java.lang.String'. |
|
758 | 245 |
result := javaClassRef resolve. |
246 |
self assertTrue: (result = expectedResult). |
|
247 |
||
248 |
"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
|
249 |
"Modified: / 23-05-2011 / 17:58:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 250 |
! |
251 |
||
252 |
testInvalidation |
|
253 |
| javaClassRef initString | |
|
254 |
||
255 |
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
|
256 |
javaClassRef := self getClassRefNamed: initString. |
761 | 257 |
javaClassRef owner: (Java classForName: 'java.lang.Object'). |
758 | 258 |
self assertTrue: (javaClassRef isResolved not). |
259 |
javaClassRef resolve. |
|
260 |
self assertTrue: (javaClassRef isResolved). |
|
261 |
javaClassRef invalidate. |
|
262 |
self assertTrue: (javaClassRef isResolved not). |
|
263 |
||
264 |
"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
|
265 |
"Modified: / 23-05-2011 / 17:58:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 266 |
! |
267 |
||
268 |
testInvalidationForClassNegative |
|
269 |
| javaClassRef initString | |
|
270 |
||
771 | 271 |
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
|
272 |
javaClassRef := self getClassRefNamed: initString. |
761 | 273 |
javaClassRef owner: (Java classForName: 'java.lang.Object'). |
758 | 274 |
self assertTrue: (javaClassRef isResolved not). |
275 |
javaClassRef resolve. |
|
276 |
self assertTrue: (javaClassRef isResolved). |
|
761 | 277 |
javaClassRef invalidateForClass: 'Ljava/lang/Object;'. |
758 | 278 |
self assertTrue: (javaClassRef isResolved). |
279 |
||
280 |
"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
|
281 |
"Modified: / 23-05-2011 / 17:58:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 282 |
! |
283 |
||
284 |
testInvalidationForClassPositive |
|
285 |
| javaClassRef initString | |
|
286 |
||
287 |
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
|
288 |
javaClassRef := self getClassRefNamed: initString. |
761 | 289 |
javaClassRef owner: (Java classForName: 'java.lang.Object'). |
758 | 290 |
self assertTrue: (javaClassRef isResolved not). |
291 |
javaClassRef resolve. |
|
292 |
self assertTrue: (javaClassRef isResolved). |
|
761 | 293 |
javaClassRef invalidateForClass: initString. |
758 | 294 |
self assertTrue: (javaClassRef isResolved not). |
295 |
||
296 |
"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
|
297 |
"Modified: / 23-05-2011 / 17:57:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 298 |
! |
299 |
||
300 |
testResolving |
|
761 | 301 |
| javaClassRef initString | |
758 | 302 |
|
761 | 303 |
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
|
304 |
javaClassRef := self getClassRefNamed: initString. |
761 | 305 |
javaClassRef owner: (Java classForName: 'java.lang.Object'). |
306 |
self assertTrue: (javaClassRef isResolved not). |
|
307 |
javaClassRef resolve. |
|
308 |
self assertTrue: (javaClassRef isResolved). |
|
758 | 309 |
|
310 |
"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
|
311 |
"Modified: / 23-05-2011 / 17:57:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 312 |
! ! |
313 |
||
314 |
!JavaClassRefTests class methodsFor:'documentation'! |
|
315 |
||
316 |
version_SVN |
|
317 |
^ '$Id$' |
|
318 |
! ! |