author | hlopkmar |
Mon, 23 May 2011 16:05:45 +0000 | |
branch | jk_new_structure |
changeset 816 | 4e3072021201 |
parent 815 | f98e7173ef67 |
child 877 | f5a5b93e1c78 |
permissions | -rw-r--r-- |
758 | 1 |
"{ Package: 'stx:libjava' }" |
2 |
||
773 | 3 |
AbstractJavaTestCase subclass:#JavaInterfaceMethodRefTests |
758 | 4 |
instanceVariableNames:'' |
5 |
classVariableNames:'' |
|
6 |
poolDictionaries:'' |
|
7 |
category:'Languages-Java-Tests-RuntimeConstantPool' |
|
8 |
! |
|
9 |
||
10 |
||
11 |
!JavaInterfaceMethodRefTests methodsFor:'javaInterfaceMethodRef tests'! |
|
12 |
||
13 |
testCorrectInstanceCreation |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
14 |
| initString javaMethodRef | |
758 | 15 |
|
16 |
initString := 'Ljava/lang/Runnable;'. |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
17 |
javaMethodRef := self |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
18 |
getInterfaceMethodRefNamed: 'run' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
19 |
typed: '()V' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
20 |
inClass: initString. |
758 | 21 |
self assertTrue: (javaMethodRef isResolved not). |
22 |
self assertTrue: (javaMethodRef valueCache isNil). |
|
23 |
self assertTrue: (javaMethodRef name = 'run'). |
|
24 |
self assertTrue: (javaMethodRef descriptor = '()V'). |
|
25 |
self assertTrue: (javaMethodRef classRef name = 'Ljava/lang/Runnable;'). |
|
26 |
||
27 |
"Created: / 08-04-2011 / 14:01:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
28 |
"Modified: / 23-05-2011 / 17:19:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 29 |
! |
30 |
||
31 |
testCorrectResolving |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
32 |
| initString javaMethodRef expectedResult result | |
758 | 33 |
|
34 |
initString := 'Ljava/lang/Runnable;'. |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
35 |
javaMethodRef := self |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
36 |
getInterfaceMethodRefNamed: 'run' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
37 |
typed: '()V' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
38 |
inClass: initString. |
758 | 39 |
result := javaMethodRef resolve. |
761 | 40 |
expectedResult := (Java classForName: 'java.lang.Runnable') |
41 |
methodDictionary at: #'run()V'. |
|
758 | 42 |
self assertTrue: (result = expectedResult). |
43 |
||
44 |
"Created: / 08-04-2011 / 14:07:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
45 |
"Modified: / 23-05-2011 / 17:18:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 46 |
! |
47 |
||
48 |
testInvalidation |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
49 |
| javaMethodRef initString| |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
50 |
|
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
51 |
initString :='Ljava/lang/Runnable;'. |
758 | 52 |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
53 |
javaMethodRef := javaMethodRef := self |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
54 |
getInterfaceMethodRefNamed: 'run' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
55 |
typed: '()V' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
56 |
inClass: initString. |
758 | 57 |
self assertTrue: (javaMethodRef isResolved not). |
58 |
javaMethodRef resolve. |
|
59 |
self assertTrue: (javaMethodRef isResolved). |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
60 |
self assertTrue: (javaMethodRef classRef isResolved). |
758 | 61 |
javaMethodRef invalidate. |
62 |
self assertTrue: (javaMethodRef isResolved not). |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
63 |
self assertTrue: (javaMethodRef classRef isResolved not). |
758 | 64 |
|
65 |
"Created: / 08-04-2011 / 14:09:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
66 |
"Modified: / 23-05-2011 / 17:19:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 67 |
! |
68 |
||
69 |
testInvalidationForClassNegative |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
70 |
| javaMethodRef initString| |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
71 |
|
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
72 |
initString :='Ljava/lang/Runnable;'. |
758 | 73 |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
74 |
javaMethodRef := javaMethodRef := self |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
75 |
getInterfaceMethodRefNamed: 'run' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
76 |
typed: '()V' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
77 |
inClass: initString. |
758 | 78 |
self assertTrue: (javaMethodRef isResolved not). |
79 |
javaMethodRef resolve. |
|
80 |
self assertTrue: (javaMethodRef isResolved). |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
81 |
self assertTrue: (javaMethodRef classRef isResolved). |
758 | 82 |
javaMethodRef invalidateForClass: 'Ljava/lang/Object;'. |
83 |
self assertTrue: (javaMethodRef isResolved). |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
84 |
self assertTrue: (javaMethodRef classRef isResolved). |
758 | 85 |
|
86 |
"Created: / 08-04-2011 / 16:23:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
87 |
"Modified: / 23-05-2011 / 17:20:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 88 |
! |
89 |
||
90 |
testInvalidationForClassPositive |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
91 |
| javaMethodRef initString| |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
92 |
|
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
93 |
initString :='Ljava/lang/Runnable;'. |
758 | 94 |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
95 |
javaMethodRef := javaMethodRef := self |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
96 |
getInterfaceMethodRefNamed: 'run' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
97 |
typed: '()V' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
98 |
inClass: initString. |
758 | 99 |
self assertTrue: (javaMethodRef isResolved not). |
100 |
javaMethodRef resolve. |
|
101 |
self assertTrue: (javaMethodRef isResolved). |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
102 |
self assertTrue: (javaMethodRef classRef isResolved). |
758 | 103 |
javaMethodRef invalidateForClass: 'Ljava/lang/Runnable;'. |
104 |
self assertTrue: (javaMethodRef isResolved not). |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
105 |
self assertTrue: (javaMethodRef classRef isResolved not). |
758 | 106 |
|
107 |
"Created: / 08-04-2011 / 16:23:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
108 |
"Modified: / 23-05-2011 / 17:20:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 109 |
! |
110 |
||
111 |
testResolving |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
112 |
| javaMethodRef initString| |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
113 |
|
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
114 |
initString :='Ljava/lang/Runnable;'. |
758 | 115 |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
116 |
javaMethodRef := javaMethodRef := self |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
117 |
getInterfaceMethodRefNamed: 'run' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
118 |
typed: '()V' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
119 |
inClass: initString. |
758 | 120 |
self assertTrue: (javaMethodRef isResolved not). |
121 |
javaMethodRef resolve. |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
122 |
self assertTrue: (javaMethodRef classRef isResolved). |
758 | 123 |
self assertTrue: (javaMethodRef isResolved). |
124 |
||
125 |
"Created: / 08-04-2011 / 14:04:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
126 |
"Modified: / 23-05-2011 / 17:21:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
761 | 127 |
! ! |
128 |
||
129 |
!JavaInterfaceMethodRefTests methodsFor:'permission tests'! |
|
130 |
||
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
131 |
testAccessingPublicFromSubclass |
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
132 |
| javaMethodRef initString | |
761 | 133 |
|
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
134 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'. |
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
135 |
self |
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
136 |
should: |
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
137 |
[ javaMethodRef := self |
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
138 |
getInterfaceMethodRefNamed: 'publicMethod' |
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
139 |
typed: '()Ljava/lang/String;' |
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
140 |
inClass: initString. |
771 | 141 |
javaMethodRef resolve. ] |
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
142 |
raise: Error |
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
143 |
suchThat: [:e | e messageText = 'IncompatibleClassChangeError' ]. |
761 | 144 |
|
145 |
"Created: / 13-04-2011 / 14:49:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
146 |
"Modified: / 23-05-2011 / 17:54:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 147 |
! ! |
148 |
||
149 |
!JavaInterfaceMethodRefTests class methodsFor:'documentation'! |
|
150 |
||
151 |
version_SVN |
|
152 |
^ '$Id$' |
|
153 |
! ! |