"
COPYRIGHT (c) 1996-2011 by Claus Gittinger
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
SWING Research Group, Czech Technical University in Prague
Parts of the code written by Claus Gittinger are under following
license:
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the 'Software'), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
[1] Code written at SWING Research Group contain a signature
of one of the above copright owners.
"
"{ Package: 'stx:libjava' }"
AbstractJavaTestCase subclass:#JavaRefTests
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'Languages-Java-Tests-RuntimeConstantPool'
!
!JavaRefTests class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 1996-2011 by Claus Gittinger
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
SWING Research Group, Czech Technical University in Prague
Parts of the code written by Claus Gittinger are under following
license:
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the 'Software'), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
[1] Code written at SWING Research Group contain a signature
of one of the above copright owners.
"
! !
!JavaRefTests methodsFor:'javaRef tests'!
testCorrectInstanceCreation
| javaRef |
javaRef := JavaRef2 new.
self assertFalse: (javaRef isResolved).
self assertTrue: (javaRef valueCache isNil).
self should: [ javaRef resolve ] raise: SubclassResponsibilityError.
self should: [ javaRef resolveStatic ] raise: SubclassResponsibilityError.
"Created: / 08-04-2011 / 11:40:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
"Modified: / 26-04-2011 / 13:21:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
testMockedInvalidating
| javaRefMock |
javaRefMock := JavaRefMock new.
self assertFalse: (javaRefMock isResolved).
self assertTrue: (javaRefMock valueCache isNil).
self assertTrue: (javaRefMock resolve = 'ok').
self assertTrue: (javaRefMock isResolved).
javaRefMock invalidate.
self assertFalse: (javaRefMock isResolved).
self assertTrue: (javaRefMock valueCache isNil).
self assertTrue: (javaRefMock resolveStatic = 'static').
self assertTrue: (javaRefMock isResolved).
javaRefMock invalidate.
self assertFalse: (javaRefMock isResolved).
self assertTrue: (javaRefMock valueCache isNil).
"Created: / 08-04-2011 / 11:50:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
"Modified: / 26-04-2011 / 13:21:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
testMockedInvalidatingForClassNegative
| javaRefMock |
javaRefMock := JavaRefMock new.
self assertTrue: (javaRefMock isResolved not).
javaRefMock resolve.
self assertTrue: (javaRefMock isResolved).
javaRefMock invalidateForClass: 'Ljava/lang/String;'.
self assertTrue: (javaRefMock isResolved).
javaRefMock invalidate.
self assertTrue: (javaRefMock isResolved not).
javaRefMock resolveStatic.
self assertTrue: (javaRefMock isResolved).
javaRefMock invalidateForClass: 'Ljava/lang/String;'.
self assertTrue: (javaRefMock isResolved).
"Created: / 08-04-2011 / 16:19:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
"Modified: / 26-04-2011 / 13:22:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
testMockedInvalidatingForClassPositive
| javaRefMock |
javaRefMock := JavaRefMock new.
self assertTrue: (javaRefMock isResolved not).
javaRefMock resolve.
self assertTrue: (javaRefMock isResolved).
javaRefMock invalidateForClass: 'mock'.
self assertTrue: (javaRefMock isResolved not).
javaRefMock resolveStatic.
self assertTrue: (javaRefMock isResolved).
javaRefMock invalidateForClass: 'mock'.
self assertTrue: (javaRefMock isResolved not).
"Created: / 08-04-2011 / 16:19:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
"Modified: / 26-04-2011 / 13:23:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
testMockedResolving
| javaRefMock |
javaRefMock := JavaRefMock new.
self assertFalse: (javaRefMock isResolved).
self assertTrue: (javaRefMock valueCache isNil).
self assertTrue: (javaRefMock resolve = 'ok').
self assertTrue: (javaRefMock isResolved).
"Created: / 08-04-2011 / 11:47:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
!
testMockedResolvingStatic
| javaRefMock |
javaRefMock := JavaRefMock new.
self assertFalse: (javaRefMock isResolved).
self assertTrue: (javaRefMock valueCache isNil).
self assertTrue: (javaRefMock resolveStatic = 'static').
self assertTrue: (javaRefMock isResolved).
"Created: / 26-04-2011 / 13:23:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
! !
!JavaRefTests class methodsFor:'documentation'!
version_SVN
^ '$Id$'
! !