author | hlopkmar |
Fri, 13 May 2011 08:01:14 +0000 | |
branch | jk_new_structure |
changeset 778 | caa3a009f617 |
parent 777 | e6e61412ae43 |
child 814 | 68df82c46fb0 |
permissions | -rw-r--r-- |
773 | 1 |
"{ Package: 'stx:libjava' }" |
2 |
||
3 |
TestCase subclass:#AbstractJavaTestCase |
|
4 |
instanceVariableNames:'exceptionThrowerBackup' |
|
5 |
classVariableNames:'' |
|
6 |
poolDictionaries:'' |
|
7 |
category:'Languages-Java-Tests-RuntimeConstantPool' |
|
8 |
! |
|
9 |
||
10 |
||
11 |
!AbstractJavaTestCase class methodsFor:'resources'! |
|
12 |
||
13 |
resources |
|
14 |
^ Array with: JavaInitializedResource with: JavaTestsResource. |
|
15 |
||
16 |
"Created: / 26-04-2011 / 13:03:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
17 |
! ! |
|
18 |
||
19 |
!AbstractJavaTestCase methodsFor:'helpers'! |
|
20 |
||
21 |
disableMockedExceptionThrowing |
|
22 |
JavaResolver uniqueInstance exceptionThrower: exceptionThrowerBackup. |
|
23 |
||
24 |
"Created: / 13-04-2011 / 14:11:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
25 |
! |
|
26 |
||
27 |
enableMockedExceptionThrowing |
|
28 |
exceptionThrowerBackup := JavaResolver uniqueInstance exceptionThrower. |
|
29 |
JavaResolver uniqueInstance exceptionThrower: JavaExceptionThrowerMock new. |
|
30 |
||
31 |
"Created: / 13-04-2011 / 14:11:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
32 |
! |
|
33 |
||
34 |
getClassRefFor: classString |
|
35 |
^ JavaClassRef2 in: (JavaConstantPool with: classString) |
|
36 |
withNameAt: 1. |
|
37 |
||
38 |
"Created: / 10-05-2011 / 15:03:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
39 |
! |
|
40 |
||
777 | 41 |
getClassRefIn: aJavaConstantPool withNameAt: nameCPIndex |
42 |
^ JavaClassRef2 in: aJavaConstantPool withNameAt: nameCPIndex. |
|
43 |
||
44 |
"Created: / 12-05-2011 / 19:14:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
45 |
! |
|
46 |
||
773 | 47 |
getCrateClassReadStream |
48 |
^ ((Filename named: UserPreferences current javaTestsDirectory) |
|
49 |
/ 'libjava' / 'bin' |
|
50 |
/ 'stx' / 'libjava' |
|
51 |
/ 'tests' / 'mocks' |
|
52 |
/ 'Crate.class') readStream. |
|
53 |
||
54 |
"Created: / 10-05-2011 / 12:13:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
55 |
"Modified: / 12-05-2011 / 16:26:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
56 |
! |
|
57 |
||
58 |
getName: name descriptor: type |
|
59 |
^ JavaNameAndType2 |
|
60 |
in: (JavaConstantPool with: name with: type) |
|
61 |
withNameAt: 1 |
|
62 |
andDescriptorAt: 2. |
|
63 |
||
64 |
"Created: / 10-05-2011 / 16:01:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
777 | 65 |
! |
66 |
||
67 |
getNameAndTypeIn: aJavaConstantPool nameAt: nameCPIndex typeAt: typeCPIndex |
|
68 |
^ JavaNameAndType2 in: aJavaConstantPool withNameAt: nameCPIndex andDescriptorAt: typeCPIndex. |
|
69 |
||
70 |
"Created: / 12-05-2011 / 19:15:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
71 |
! |
|
72 |
||
778
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
73 |
getPrettyBigConstantPool |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
74 |
| cp | |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
75 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
76 |
cp := JavaConstantPool new: 20. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
77 |
cp at: 1 put: 6. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
78 |
cp at: 2 put: 'Ljava/lang/Object;'. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
79 |
cp at: 3 putClassRefWithNameAt: 2. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
80 |
cp |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
81 |
at: 4 |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
82 |
putMethodRefWithClassAt: 3 |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
83 |
andNameAndTypeAt: 5. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
84 |
cp |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
85 |
at: 5 |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
86 |
putNameAndTypeWithNameAt: 6 |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
87 |
andDescriptorAt: 7. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
88 |
cp at: 6 put: '<init>'. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
89 |
cp at: 7 put: '()V'. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
90 |
cp at: 8 put: 'Ljava/lang/String;'. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
91 |
cp at: 9 putClassRefWithNameAt: 8. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
92 |
cp |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
93 |
at: 10 |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
94 |
putMethodRefWithClassAt: 9 |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
95 |
andNameAndTypeAt: 13. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
96 |
cp at: 11 put: 'length'. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
97 |
cp at: 12 put: '()I'. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
98 |
cp |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
99 |
at: 13 |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
100 |
putNameAndTypeWithNameAt: 11 |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
101 |
andDescriptorAt: 12. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
102 |
cp at: 14 putClassRefWithNameAt: 15. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
103 |
cp at: 15 put: 'Ljava/lang/Runnable;'. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
104 |
cp at: 16 put: 'run'. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
105 |
cp at: 17 put: '()V'. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
106 |
cp |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
107 |
at: 18 |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
108 |
putNameAndTypeWithNameAt: 16 |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
109 |
andDescriptorAt: 17. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
110 |
cp at: 19 putClassRefWithNameAt: 15. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
111 |
cp |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
112 |
at: 20 |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
113 |
putInterfaceMethodRefWithClassAt: 19 |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
114 |
andNameAndTypeAt: 18. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
115 |
^ cp |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
116 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
117 |
"Modified: / 13-05-2011 / 09:53:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
118 |
! |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
777
diff
changeset
|
119 |
|
777 | 120 |
javaLangObject |
121 |
^Java classForName:'java.lang.Object'. |
|
122 |
||
123 |
"Created: / 12-05-2011 / 19:09:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
773 | 124 |
! ! |
125 |
||
774 | 126 |
!AbstractJavaTestCase methodsFor:'running'! |
127 |
||
128 |
setUp |
|
129 |
JavaClassReader useNewClassReader. |
|
777 | 130 |
self enableMockedExceptionThrowing. |
774 | 131 |
|
132 |
"Created: / 12-05-2011 / 17:30:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
133 |
! |
|
134 |
||
135 |
tearDown |
|
136 |
JavaClassReader useOldClassReader. |
|
777 | 137 |
self disableMockedExceptionThrowing. |
774 | 138 |
|
139 |
"Created: / 12-05-2011 / 17:30:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
140 |
! ! |
|
141 |
||
773 | 142 |
!AbstractJavaTestCase class methodsFor:'documentation'! |
143 |
||
144 |
version_SVN |
|
145 |
^ '$Id$' |
|
146 |
! ! |