--- a/src/AbstractJavaTestCase.st Mon May 23 12:42:27 2011 +0000
+++ b/src/AbstractJavaTestCase.st Mon May 23 14:53:35 2011 +0000
@@ -16,6 +16,89 @@
"Created: / 26-04-2011 / 13:03:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
+!AbstractJavaTestCase methodsFor:'cp creation helpers'!
+
+getClassRefNamed: name
+ "creates classRef with correctly prepared constant pool"
+
+ | cp |
+
+ cp := JavaConstantPool new:2.
+ cp at: 1 put: (self getClassRefIn: cp withNameAt: 2).
+ cp at: 2 put: name.
+
+ ^ cp at: 1.
+
+ "Created: / 23-05-2011 / 16:17:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+getFieldRefNamed: name typed: type inClass: classString
+ "creates fieldRef with correctly prepared constant pool"
+ | cp |
+
+ cp := JavaConstantPool new: 6.
+ cp at: 1 put: (self getClassRefIn: cp withNameAt: 2).
+ cp at: 2 put: classString.
+ cp at: 3 put: name.
+ cp at: 4 put: type.
+ cp at: 5
+ put: (self
+ getFieldRefIn: cp
+ withNameAndTypeAt: 6 andClassAt: 1).
+ cp at: 6 put: (self getNameAndTypeIn: cp withNameAt: 3 andTypeAt: 4).
+ ^ cp at: 5.
+
+ "Created: / 23-05-2011 / 15:56:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+getInterfaceMethodRefNamed: name typed: type inClass: classString
+ "creates interfaceMethodRef with correctly prepared constant pool"
+ | cp |
+
+ cp := JavaConstantPool new: 6.
+ cp at: 1 put: (self getClassRefIn: cp withNameAt: 2).
+ cp at: 2 put: classString.
+ cp at: 3 put: name.
+ cp at: 4 put: type.
+ cp at: 5
+ put: (self
+ getInterfaceMethodRefIn: cp
+ withNameAndTypeAt: 6
+ andClassAt: 1).
+ cp at: 6
+ put: (self
+ getNameAndTypeIn: cp
+ withNameAt: 3
+ andTypeAt: 4).
+ ^ cp at: 5.
+
+ "Created: / 23-05-2011 / 16:15:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+getMethodRefNamed: name typed: type inClass: classString
+ "creates methodRef with correctly prepared constant pool"
+ | cp |
+
+ cp := JavaConstantPool new: 6.
+ cp at: 1 put: (self getClassRefIn: cp withNameAt: 2).
+ cp at: 2 put: classString.
+ cp at: 3 put: name.
+ cp at: 4 put: type.
+ cp at: 5
+ put: (self
+ getMethodRefIn: cp
+ withNameAndTypeAt: 6
+ andClassAt: 1).
+ cp at: 6
+ put: (self
+ getNameAndTypeIn: cp
+ withNameAt: 3
+ andTypeAt: 4).
+ ^ cp at: 5.
+
+ "Created: / 23-05-2011 / 16:00:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
!AbstractJavaTestCase methodsFor:'helpers'!
disableMockedExceptionThrowing
@@ -31,19 +114,6 @@
"Created: / 13-04-2011 / 14:11:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
-getClassRefFor: classString
-^ JavaClassRef2 in: (JavaConstantPool with: classString)
- withNameAt: 1.
-
- "Created: / 10-05-2011 / 15:03:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-!
-
-getClassRefIn: aJavaConstantPool withNameAt: nameCPIndex
-^ JavaClassRef2 in: aJavaConstantPool withNameAt: nameCPIndex.
-
- "Created: / 12-05-2011 / 19:14:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-!
-
getCrateClassReadStream
^ ((Filename named: UserPreferences current javaTestsDirectory)
/ 'libjava' / 'bin'
@@ -55,21 +125,6 @@
"Modified: / 12-05-2011 / 16:26:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
-getName: name descriptor: type
- ^ JavaNameAndType2
- in: (JavaConstantPool with: name with: type)
- withNameAt: 1
- andDescriptorAt: 2.
-
- "Created: / 10-05-2011 / 16:01:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-!
-
-getNameAndTypeIn: aJavaConstantPool nameAt: nameCPIndex typeAt: typeCPIndex
- ^ JavaNameAndType2 in: aJavaConstantPool withNameAt: nameCPIndex andDescriptorAt: typeCPIndex.
-
- "Created: / 12-05-2011 / 19:15:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-!
-
getPrettyBigConstantPool
| cp |
@@ -114,7 +169,7 @@
andNameAndTypeAt: 18.
^ cp
- "Modified: / 13-05-2011 / 09:53:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 15:16:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
javaLangObject
@@ -123,6 +178,71 @@
"Created: / 12-05-2011 / 19:09:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
+!AbstractJavaTestCase methodsFor:'refs creation'!
+
+getClassRefIn: aJavaConstantPool withNameAt: nameCPIndex
+ | result |
+
+ result := JavaClassRef2 in: aJavaConstantPool withNameAt: nameCPIndex.
+ result owner: self javaLangObject.
+ ^ result.
+
+ "Created: / 12-05-2011 / 19:14:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 23-05-2011 / 16:24:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+getFieldRefIn: cp withNameAndTypeAt: nmIndex andClassAt: classIndex
+ |result|
+
+ result := JavaFieldRef2
+ in: cp
+ withNameAndTypeAt: nmIndex
+ andClassAt: classIndex.
+result owner: self javaLangObject.
+ ^ result.
+
+ "Created: / 23-05-2011 / 16:01:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+getInterfaceMethodRefIn: cp withNameAndTypeAt: nmIndex andClassAt: classIndex
+ |result|
+
+ result:= JavaInterfaceMethodRef2
+ in: cp
+ withNameAndTypeAt: nmIndex
+ andClassAt: classIndex.
+ result owner: self javaLangObject.
+ ^ result.
+
+ "Created: / 23-05-2011 / 15:58:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+getMethodRefIn: cp withNameAndTypeAt: nmIndex andClassAt: classIndex
+ |result|
+
+ result := JavaMethodRef2
+ in: cp
+ withNameAndTypeAt: nmIndex
+ andClassAt: classIndex.
+ result owner: self javaLangObject.
+ ^ result.
+
+ "Created: / 23-05-2011 / 15:58:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+!
+
+getNameAndTypeIn: cp withNameAt: nameIndex andTypeAt: typeIndex
+ |result|
+
+ result := JavaNameAndType2
+ in: cp
+ withNameAt: nameIndex
+ andDescriptorAt: typeIndex.
+ result owner: self javaLangObject.
+ ^ result.
+
+ "Created: / 23-05-2011 / 16:00:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+! !
+
!AbstractJavaTestCase methodsFor:'running'!
setUp