You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2012/04/02 23:24:38 UTC
svn commit: r1308577 -
/tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/
Author: hlship
Date: Mon Apr 2 21:24:37 2012
New Revision: 1308577
URL: http://svn.apache.org/viewvc?rev=1308577&view=rev
Log:
More changes towards idiomatic Groovy
Modified:
tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/ArrayAttributeAnnotations.groovy
tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/ClassAnnotationAccess.groovy
tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/ConstructorCallbackTests.groovy
tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldAccessTests.groovy
tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldAnnotationAccess.groovy
tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldClaiming.groovy
tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldConduitTests.groovy
tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldHandleTests.groovy
tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldInjection.groovy
tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/IntroduceFieldTests.groovy
tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodAdviceTests.groovy
tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodAnnotationAccess.groovy
tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodHandleAccess.groovy
tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodImplementationTests.groovy
tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodIntroduction.groovy
tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodProxying.groovy
tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/ObtainPlasticClass.groovy
tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/ParameterAnnotationsTest.groovy
tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/SimpleClassLoading.groovy
tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/StaticFieldAccess.groovy
Modified: tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/ArrayAttributeAnnotations.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/ArrayAttributeAnnotations.groovy?rev=1308577&r1=1308576&r2=1308577&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/ArrayAttributeAnnotations.groovy (original)
+++ tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/ArrayAttributeAnnotations.groovy Mon Apr 2 21:24:37 2012
@@ -2,12 +2,15 @@ package org.apache.tapestry5.plastic
import testannotations.ArrayAnnotation
import testannotations.Truth
+import testsubjects.AnnotationSubject
+import testsubjects.ArrayAttributesSubject
+import testsubjects.ExplicityEmptyArrayAttributesSubject
class ArrayAttributeAnnotations extends AbstractPlasticSpecification {
def "handling of array attribute defaults"() {
when:
- def pc = mgr.getPlasticClass("testsubjects.AnnotationSubject")
+ def pc = mgr.getPlasticClass(AnnotationSubject.name)
def a = pc.getAnnotation(ArrayAnnotation)
@@ -20,7 +23,7 @@ class ArrayAttributeAnnotations extends
def "explicit values for array attributes"() {
when:
- def pc = mgr.getPlasticClass("testsubjects.ArrayAttributesSubject")
+ def pc = mgr.getPlasticClass(ArrayAttributesSubject.name)
def a = pc.getAnnotation(ArrayAnnotation)
then:
@@ -38,7 +41,7 @@ class ArrayAttributeAnnotations extends
def "handling of explicitly empty array attributes"() {
when:
- def pc = mgr.getPlasticClass("testsubjects.ExplicityEmptyArrayAttributesSubject")
+ def pc = mgr.getPlasticClass(ExplicityEmptyArrayAttributesSubject.name)
def a = pc.getAnnotation(ArrayAnnotation)
Modified: tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/ClassAnnotationAccess.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/ClassAnnotationAccess.groovy?rev=1308577&r1=1308576&r2=1308577&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/ClassAnnotationAccess.groovy (original)
+++ tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/ClassAnnotationAccess.groovy Mon Apr 2 21:24:37 2012
@@ -2,10 +2,12 @@ package org.apache.tapestry5.plastic
import testannotations.InheritedAnnotation
import testannotations.SimpleAnnotation
+import testsubjects.AnnotationSubject
+import testsubjects.InheritedAnnotationSubClass
class ClassAnnotationAccess extends AbstractPlasticSpecification {
- def pc = mgr.getPlasticClass("testsubjects.AnnotationSubject")
+ def pc = mgr.getPlasticClass(AnnotationSubject.name)
def "access to non-existent annotation"() {
@@ -32,7 +34,7 @@ class ClassAnnotationAccess extends Abst
}
def "inherited class annotations visible in subclass"() {
- def pc = mgr.getPlasticClass("testsubjects.InheritedAnnotationSubClass")
+ def pc = mgr.getPlasticClass(InheritedAnnotationSubClass.name)
expect:
pc.hasAnnotation(InheritedAnnotation) == true
Modified: tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/ConstructorCallbackTests.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/ConstructorCallbackTests.groovy?rev=1308577&r1=1308576&r2=1308577&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/ConstructorCallbackTests.groovy (original)
+++ tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/ConstructorCallbackTests.groovy Mon Apr 2 21:24:37 2012
@@ -1,5 +1,7 @@
package org.apache.tapestry5.plastic
+import testsubjects.Empty
+
class ConstructorCallbackTests extends AbstractPlasticSpecification
{
def "constructor callback invoked after field injection"()
@@ -21,7 +23,7 @@ class ConstructorCallbackTests extends A
when:
- mgr.getClassInstantiator("testsubjects.Empty").newInstance()
+ mgr.getClassInstantiator(Empty.name).newInstance()
then:
Modified: tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldAccessTests.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldAccessTests.groovy?rev=1308577&r1=1308576&r2=1308577&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldAccessTests.groovy (original)
+++ tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldAccessTests.groovy Mon Apr 2 21:24:37 2012
@@ -2,6 +2,8 @@ package org.apache.tapestry5.plastic
import testannotations.KindaInject
import testannotations.SimpleAnnotation
+import testsubjects.ProtectedField
+import testsubjects.ProtectedFieldCollaborator
/**
* Tests related to access to non-private fields between transformed classes (a new feature in 5.4).
@@ -12,13 +14,13 @@ class FieldAccessTests extends AbstractP
{
FieldConduit fc = Mock()
- PlasticClass pc = mgr.getPlasticClass("testsubjects.ProtectedField")
+ PlasticClass pc = mgr.getPlasticClass(ProtectedField.name)
pc.allFields.first().setConduit(fc)
def delegate = pc.createInstantiator().newInstance()
- pc = mgr.getPlasticClass("testsubjects.ProtectedFieldCollaborator")
+ pc = mgr.getPlasticClass(ProtectedFieldCollaborator.name)
pc.allFields.first().inject(delegate)
@@ -62,9 +64,9 @@ class FieldAccessTests extends AbstractP
def mgr = createMgr(installFieldConduit, handleInjection)
- delegate = mgr.getClassInstantiator("testsubjects.ProtectedField").newInstance()
+ delegate = mgr.getClassInstantiator(ProtectedField.name).newInstance()
- def collab = mgr.getClassInstantiator("testsubjects.ProtectedFieldCollaborator").newInstance()
+ def collab = mgr.getClassInstantiator(ProtectedFieldCollaborator.name).newInstance()
when:
Modified: tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldAnnotationAccess.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldAnnotationAccess.groovy?rev=1308577&r1=1308576&r2=1308577&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldAnnotationAccess.groovy (original)
+++ tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldAnnotationAccess.groovy Mon Apr 2 21:24:37 2012
@@ -1,6 +1,7 @@
package org.apache.tapestry5.plastic
import testannotations.Maybe
+import testsubjects.AnnotationSubject
class FieldAnnotationAccess extends AbstractPlasticSpecification
{
@@ -8,7 +9,7 @@ class FieldAnnotationAccess extends Abst
def "read static field"()
{
setup:
- def pc = mgr.getPlasticClass("testsubjects.AnnotationSubject")
+ def pc = mgr.getPlasticClass(AnnotationSubject.name)
when:
def fields = pc.getFieldsWithAnnotation(Maybe)
Modified: tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldClaiming.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldClaiming.groovy?rev=1308577&r1=1308576&r2=1308577&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldClaiming.groovy (original)
+++ tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldClaiming.groovy Mon Apr 2 21:24:37 2012
@@ -14,15 +14,13 @@
package org.apache.tapestry5.plastic
-import org.apache.tapestry5.plastic.PlasticManager;
-
-import spock.lang.Specification;
+import testsubjects.SingleField
class FieldClaiming extends AbstractPlasticSpecification
{
def "get fields ignores claimed fields"() {
setup:
- def pc = mgr.getPlasticClass("testsubjects.SingleField")
+ def pc = mgr.getPlasticClass(SingleField.name)
def f = pc.unclaimedFields.first()
expect:
@@ -42,7 +40,7 @@ class FieldClaiming extends AbstractPlas
def "a field may only be claimed once"() {
setup:
- def pc = mgr.getPlasticClass("testsubjects.SingleField")
+ def pc = mgr.getPlasticClass(SingleField.name)
def f = pc.unclaimedFields.first()
f.claim "[first tag]"
Modified: tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldConduitTests.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldConduitTests.groovy?rev=1308577&r1=1308576&r2=1308577&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldConduitTests.groovy (original)
+++ tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldConduitTests.groovy Mon Apr 2 21:24:37 2012
@@ -2,6 +2,7 @@ package org.apache.tapestry5.plastic
import testannotations.KindaInject
import testinterfaces.Logger
+import testsubjects.*
class FieldConduitTests extends AbstractPlasticSpecification
{
@@ -10,7 +11,7 @@ class FieldConduitTests extends Abstract
FieldConduit fc = Mock()
- def pc = mgr.getPlasticClass("testsubjects.IntFieldHolder")
+ def pc = mgr.getPlasticClass(IntFieldHolder.name)
pc.allFields.first().setConduit(fc)
@@ -43,7 +44,7 @@ class FieldConduitTests extends Abstract
{
FieldConduit fc = Mock()
- def pc = mgr.getPlasticClass("testsubjects.IntFieldHolder")
+ def pc = mgr.getPlasticClass(IntFieldHolder.name)
pc.allFields.first().setComputedConduit({ return fc } as ComputedValue)
@@ -62,7 +63,7 @@ class FieldConduitTests extends Abstract
{
FieldConduit fc = Mock()
- def pc = mgr.getPlasticClass("testsubjects.LongFieldHolder")
+ def pc = mgr.getPlasticClass(LongFieldHolder.name)
pc.allFields.first().setConduit(fc)
@@ -96,7 +97,7 @@ class FieldConduitTests extends Abstract
] as PlasticManagerDelegate).packages(["testsubjects"]).create()
- def o = mgr.getClassInstantiator("testsubjects.AccessMethodsSubject").newInstance()
+ def o = mgr.getClassInstantiator(AccessMethodsSubject.name).newInstance()
def i = o.valueAccess
@@ -123,7 +124,7 @@ class FieldConduitTests extends Abstract
def mgr = PlasticManager.withContextClassLoader().enable(TransformationOption.FIELD_WRITEBEHIND).create()
- def pc = mgr.getPlasticClass("testsubjects.IntWriteBehind")
+ def pc = mgr.getPlasticClass(IntWriteBehind.name)
pc.allFields.first().setConduit(fc)
@@ -158,7 +159,7 @@ class FieldConduitTests extends Abstract
def mgr = PlasticManager.withContextClassLoader().enable(TransformationOption.FIELD_WRITEBEHIND).create()
- def pc = mgr.getPlasticClass("testsubjects.LongWriteBehind")
+ def pc = mgr.getPlasticClass(LongWriteBehind.name)
pc.allFields.first().setConduit(fc)
@@ -208,7 +209,7 @@ class FieldConduitTests extends Abstract
enableBytecodeDebugging(mgr)
}
- def o = mgr.getClassInstantiator("testsubjects.InjectSubClass").newInstance()
+ def o = mgr.getClassInstantiator(InjectSubClass.name).newInstance()
assert o.subClassLogger == logger
Modified: tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldHandleTests.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldHandleTests.groovy?rev=1308577&r1=1308576&r2=1308577&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldHandleTests.groovy (original)
+++ tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldHandleTests.groovy Mon Apr 2 21:24:37 2012
@@ -14,10 +14,12 @@
package org.apache.tapestry5.plastic
+import testsubjects.*
+
class FieldHandleTests extends AbstractPlasticSpecification
{
def "getting access to a new primitive field"() {
- def pc = mgr.getPlasticClass("testsubjects.Empty")
+ def pc = mgr.getPlasticClass(Empty.name)
def f = pc.introduceField("int", "count")
def h = f.handle
@@ -46,7 +48,7 @@ class FieldHandleTests extends AbstractP
* differently.
*/
def "access to existing long field"() {
- def pc = mgr.getPlasticClass("testsubjects.LongFieldHolder")
+ def pc = mgr.getPlasticClass(LongFieldHolder.name)
def f = pc.allFields.first()
def h = f.handle
@@ -78,7 +80,7 @@ class FieldHandleTests extends AbstractP
*/
def "default value for field is not lost"() {
- def pc = mgr.getPlasticClass("testsubjects.LongFieldHolder")
+ def pc = mgr.getPlasticClass(LongFieldHolder.name)
def f = pc.allFields.first()
def h = f.handle
@@ -91,7 +93,7 @@ class FieldHandleTests extends AbstractP
}
def "access to reference field"() {
- def pc = mgr.getPlasticClass("testsubjects.StringHolder")
+ def pc = mgr.getPlasticClass(StringHolder.name)
def f = pc.allFields.first()
def h = f.handle
@@ -117,7 +119,7 @@ class FieldHandleTests extends AbstractP
}
def "access to multiple fields in single class"() {
- def pc = mgr.getPlasticClass("testsubjects.MultipleFields")
+ def pc = mgr.getPlasticClass(MultipleFields.name)
def fred = handleByName(pc, "fred")
def barney = handleByName(pc, "barney")
@@ -166,7 +168,7 @@ class FieldHandleTests extends AbstractP
def fc = Mock(FieldConduit)
- def pc = mgr.getPlasticClass("testsubjects.FieldHandleAccessOnly")
+ def pc = mgr.getPlasticClass(FieldHandleAccessOnly.name)
def field = pc.allFields.first()
Modified: tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldInjection.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldInjection.groovy?rev=1308577&r1=1308576&r2=1308577&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldInjection.groovy (original)
+++ tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/FieldInjection.groovy Mon Apr 2 21:24:37 2012
@@ -1,5 +1,8 @@
package org.apache.tapestry5.plastic
+import testsubjects.Empty
+import testsubjects.InjectFieldSubject
+import testsubjects.StringHolder
import testsubjects.StringPropertyHolder
class FieldInjection extends AbstractPlasticSpecification
@@ -8,9 +11,9 @@ class FieldInjection extends AbstractPla
{
String injected = "Value injected into the Empty class"
- def pc = mgr.getPlasticClass("testsubjects.Empty")
+ def pc = mgr.getPlasticClass(Empty.name)
- def f = pc.introduceField("java.lang.String", "stringValue");
+ def f = pc.introduceField(String.name, "stringValue");
f.inject(injected);
@@ -29,7 +32,7 @@ class FieldInjection extends AbstractPla
String injected = "Computed value injected into the StringPropertyHolder class"
- def pc = mgr.getPlasticClass("testsubjects.StringPropertyHolder")
+ def pc = mgr.getPlasticClass(StringPropertyHolder.name)
pc.allFields.first().injectComputed({
@@ -59,7 +62,7 @@ class FieldInjection extends AbstractPla
String injected = "InstanceContext value injected into the StringPropertyHolder class"
- def pc = mgr.getPlasticClass("testsubjects.StringPropertyHolder")
+ def pc = mgr.getPlasticClass(StringPropertyHolder.name)
pc.allFields.first().injectFromInstanceContext()
@@ -79,7 +82,7 @@ class FieldInjection extends AbstractPla
def "injection of primitive value"()
{
- def pc = mgr.getPlasticClass("testsubjects.Empty")
+ def pc = mgr.getPlasticClass(Empty.name)
def f = pc.introduceField("double", "pi");
@@ -97,7 +100,7 @@ class FieldInjection extends AbstractPla
def "injected field is read-only"()
{
- def pc = mgr.getPlasticClass("testsubjects.InjectFieldSubject")
+ def pc = mgr.getPlasticClass(InjectFieldSubject.name)
def pf = pc.allFields.first();
@@ -128,7 +131,7 @@ class FieldInjection extends AbstractPla
def "injected field is read-only, even via handle"()
{
- def pc = mgr.getPlasticClass("testsubjects.InjectFieldSubject")
+ def pc = mgr.getPlasticClass(InjectFieldSubject.name)
def f = pc.allFields.first();
def h = f.handle
@@ -150,7 +153,7 @@ class FieldInjection extends AbstractPla
def "a field may only be injected once"()
{
- def pc = mgr.getPlasticClass("testsubjects.StringHolder")
+ def pc = mgr.getPlasticClass(StringHolder.name)
def f = pc.allFields.first();
f.inject("[first]")
Modified: tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/IntroduceFieldTests.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/IntroduceFieldTests.groovy?rev=1308577&r1=1308576&r2=1308577&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/IntroduceFieldTests.groovy (original)
+++ tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/IntroduceFieldTests.groovy Mon Apr 2 21:24:37 2012
@@ -1,18 +1,20 @@
package org.apache.tapestry5.plastic
+import testsubjects.Empty
+
import java.lang.reflect.Modifier
class IntroduceFieldTests extends AbstractPlasticSpecification
{
def "introduced fields are not visible in the allFields list"() {
setup:
- def pc = mgr.getPlasticClass("testsubjects.Empty")
+ def pc = mgr.getPlasticClass(Empty.name)
expect:
pc.allFields == []
when:
- def f = pc.introduceField("java.lang.String", "message")
+ def f = pc.introduceField(String.name, "message")
then:
f.toString() == "PlasticField[private java.lang.String message (in class testsubjects.Empty)]"
@@ -22,11 +24,11 @@ class IntroduceFieldTests extends Abstra
def "introducing a duplicate field name results in a unique id"() {
setup:
- def pc = mgr.getPlasticClass("testsubjects.Empty")
+ def pc = mgr.getPlasticClass(Empty.name)
when:
- def f1 = pc.introduceField("java.lang.Integer", "count")
- def f2 = pc.introduceField("java.lang.Integer", "count")
+ def f1 = pc.introduceField(Integer.name, "count")
+ def f2 = pc.introduceField(Integer.name, "count")
then:
! f1.is(f2)
@@ -39,9 +41,9 @@ class IntroduceFieldTests extends Abstra
def "instantiate a class with an introduced field"() {
setup:
- def pc = mgr.getPlasticClass("testsubjects.Empty")
+ def pc = mgr.getPlasticClass(Empty.name)
- pc.introduceField("java.lang.Integer", "count")
+ pc.introduceField(Integer.name, "count")
def ins = pc.createInstantiator()
Modified: tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodAdviceTests.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodAdviceTests.groovy?rev=1308577&r1=1308576&r2=1308577&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodAdviceTests.groovy (original)
+++ tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodAdviceTests.groovy Mon Apr 2 21:24:37 2012
@@ -6,13 +6,12 @@ import testannotations.Maybe
import testannotations.MethodAnnotation
import testannotations.Truth
import testinterfaces.MagicContainer
+import testsubjects.SingleMethod
import java.sql.SQLException
-class MethodAdviceTests extends AbstractPlasticSpecification
-{
- def "advice for a void method"()
- {
+class MethodAdviceTests extends AbstractPlasticSpecification {
+ def "advice for a void method"() {
setup:
def didInvoke = false
@@ -42,7 +41,7 @@ class MethodAdviceTests extends Abstract
when:
- def o = mgr.getClassInstantiator("testsubjects.SingleMethod").newInstance()
+ def o = mgr.getClassInstantiator(SingleMethod.name).newInstance()
then:
@@ -59,8 +58,7 @@ class MethodAdviceTests extends Abstract
didInvoke == true
}
- def "multiple advice on method with parameters and return values"()
- {
+ def "multiple advice on method with parameters and return values"() {
setup:
@@ -78,15 +76,14 @@ class MethodAdviceTests extends Abstract
} as MethodAdvice)
} as PlasticClassTransformer)
- def o = mgr.getClassInstantiator("testsubjects.MethodAdviceTarget").newInstance()
+ def o = mgr.getClassInstantiator(testsubjects.MethodAdviceTarget.name).newInstance()
expect:
o.dupe(2, "Fam") == "FAM FAM FAM FAM FAM FAM FAM FAM FAM FAM FAM FAM"
}
- def "method that throws exceptions"()
- {
+ def "method that throws exceptions"() {
setup:
@@ -94,7 +91,7 @@ class MethodAdviceTests extends Abstract
findMethod(pc, "maybeThrow").addAdvice(new NoopAdvice())
} as PlasticClassTransformer)
- def o = mgr.getClassInstantiator("testsubjects.MethodAdviceTarget").newInstance()
+ def o = mgr.getClassInstantiator(testsubjects.MethodAdviceTarget.name).newInstance()
expect:
@@ -109,21 +106,19 @@ class MethodAdviceTests extends Abstract
thrown(SQLException)
}
- def "setting return value clears checked exceptions"()
- {
+ def "setting return value clears checked exceptions"() {
def mgr = createMgr({ PlasticClass pc ->
findMethod(pc, "maybeThrow").addAdvice({ MethodInvocation mi ->
mi.proceed()
- if (mi.didThrowCheckedException())
- {
+ if (mi.didThrowCheckedException()) {
mi.setReturnValue(-1L)
}
} as MethodAdvice)
} as PlasticClassTransformer)
- def o = mgr.getClassInstantiator("testsubjects.MethodAdviceTarget").newInstance()
+ def o = mgr.getClassInstantiator(testsubjects.MethodAdviceTarget.name).newInstance()
expect:
@@ -137,15 +132,14 @@ class MethodAdviceTests extends Abstract
*
* @return
*/
- def "method with long and double parameters"()
- {
+ def "method with long and double parameters"() {
setup:
def mgr = createMgr({ PlasticClass pc ->
findMethod(pc, "doMath").addAdvice(new NoopAdvice())
} as PlasticClassTransformer)
- def o = mgr.getClassInstantiator("testsubjects.WidePrimitives").newInstance()
+ def o = mgr.getClassInstantiator(testsubjects.WidePrimitives.name).newInstance()
expect:
"The interceptor builds proper bytecode to pass the values through"
@@ -153,8 +147,7 @@ class MethodAdviceTests extends Abstract
o.doMath(2l, 4.0d, 5, 6l) == 38d
}
- def "method advice does not interfere with field instrumentation (advice first)"()
- {
+ def "method advice does not interfere with field instrumentation (advice first)"() {
FieldConduit fc = [get: { instance, context ->
return "via conduit"
}, set: { instance, context -> }] as FieldConduit
@@ -172,15 +165,14 @@ class MethodAdviceTests extends Abstract
})
} as PlasticClassTransformer)
- def o = mgr.getClassInstantiator("testsubjects.FieldConduitInsideAdvisedMethod").newInstance()
+ def o = mgr.getClassInstantiator(testsubjects.FieldConduitInsideAdvisedMethod.name).newInstance()
expect:
o.magic == "via conduit"
}
- def "method advice does not interfere with field instrumentation (conduit first)"()
- {
+ def "method advice does not interfere with field instrumentation (conduit first)"() {
FieldConduit fc = [get: { instance, context ->
return "via conduit"
}, set: { instance, context -> }] as FieldConduit
@@ -199,15 +191,14 @@ class MethodAdviceTests extends Abstract
} as PlasticClassTransformer)
- def o = mgr.getClassInstantiator("testsubjects.FieldConduitInsideAdvisedMethod").newInstance()
+ def o = mgr.getClassInstantiator(testsubjects.FieldConduitInsideAdvisedMethod.name).newInstance()
expect:
o.magic == "via conduit"
}
- def "method advice does not interfere with field instrumentation (instance context version)"()
- {
+ def "method advice does not interfere with field instrumentation (instance context version)"() {
MagicContainer container = Mock()
FieldConduit fc = [get: { instance, context ->
@@ -231,7 +222,7 @@ class MethodAdviceTests extends Abstract
if (false) { enableBytecodeDebugging(mgr) }
- def o = mgr.getClassInstantiator("testsubjects.FieldConduitInsideAdvisedMethod").with(MagicContainer, container).newInstance()
+ def o = mgr.getClassInstantiator(testsubjects.FieldConduitInsideAdvisedMethod.name).with(MagicContainer, container).newInstance()
when:
@@ -242,8 +233,7 @@ class MethodAdviceTests extends Abstract
1 * container.magic() >> "via context and mock"
}
- def "method advice on method that accesses a field with a conduit (more complex structure)"()
- {
+ def "method advice on method that accesses a field with a conduit (more complex structure)"() {
MagicContainer container = Mock()
FieldConduit fc = [get: { instance, context ->
@@ -267,7 +257,7 @@ class MethodAdviceTests extends Abstract
if (false) { enableBytecodeDebugging(mgr) }
- def o = mgr.getClassInstantiator("testsubjects.FieldConduitAdvisedMethodComplexCase").with(MagicContainer, container).newInstance()
+ def o = mgr.getClassInstantiator(testsubjects.FieldConduitAdvisedMethodComplexCase.name).with(MagicContainer, container).newInstance()
when:
Modified: tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodAnnotationAccess.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodAnnotationAccess.groovy?rev=1308577&r1=1308576&r2=1308577&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodAnnotationAccess.groovy (original)
+++ tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodAnnotationAccess.groovy Mon Apr 2 21:24:37 2012
@@ -4,10 +4,11 @@ import testannotations.Maybe
import testannotations.Outer
import testannotations.PrimitiveValues
import testannotations.Truth
+import testsubjects.AnnotationSubject
class MethodAnnotationAccess extends AbstractPlasticSpecification {
- def pc = mgr.getPlasticClass("testsubjects.AnnotationSubject")
+ def pc = mgr.getPlasticClass(AnnotationSubject.name)
def "access to method annotation with enum attribute"() {
Modified: tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodHandleAccess.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodHandleAccess.groovy?rev=1308577&r1=1308576&r2=1308577&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodHandleAccess.groovy (original)
+++ tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodHandleAccess.groovy Mon Apr 2 21:24:37 2012
@@ -1,11 +1,12 @@
package org.apache.tapestry5.plastic
+import testsubjects.MethodHandleSubject
import testsubjects.WillNotDoubleException
class MethodHandleAccess extends AbstractPlasticSpecification {
def init(name) {
- def pc = mgr.getPlasticClass("testsubjects.MethodHandleSubject")
+ def pc = mgr.getPlasticClass(MethodHandleSubject.name)
def handle = findHandle(pc, name)
Modified: tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodImplementationTests.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodImplementationTests.groovy?rev=1308577&r1=1308576&r2=1308577&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodImplementationTests.groovy (original)
+++ tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodImplementationTests.groovy Mon Apr 2 21:24:37 2012
@@ -1,5 +1,6 @@
package org.apache.tapestry5.plastic
+import testsubjects.MethodReimplementationSubject
class MethodImplementationTests extends AbstractPlasticSpecification {
def "overwrite implementation of method"() {
@@ -14,7 +15,7 @@ class MethodImplementationTests extends
when:
- def o = mgr.getClassInstantiator("testsubjects.MethodReimplementationSubject").newInstance()
+ def o = mgr.getClassInstantiator(MethodReimplementationSubject.name).newInstance()
then:
@@ -32,7 +33,7 @@ class MethodImplementationTests extends
when:
- def o = mgr.getClassInstantiator("testsubjects.MethodReimplementationSubject").newInstance()
+ def o = mgr.getClassInstantiator(MethodReimplementationSubject.name).newInstance()
then:
"There's no way to tell from the outside, but should use the ICONST_2 opcode."
@@ -43,7 +44,7 @@ class MethodImplementationTests extends
def "while, increment, array operations"() {
setup:
- PlasticClass pc = mgr.getPlasticClass("testsubjects.WhileSubject")
+ PlasticClass pc = mgr.getPlasticClass(testsubjects.WhileSubject.name)
PlasticMethod m = findMethod(pc, "firstNonNull")
Modified: tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodIntroduction.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodIntroduction.groovy?rev=1308577&r1=1308576&r2=1308577&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodIntroduction.groovy (original)
+++ tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodIntroduction.groovy Mon Apr 2 21:24:37 2012
@@ -1,15 +1,14 @@
package org.apache.tapestry5.plastic
-class MethodIntroduction extends AbstractPlasticSpecification
-{
+import testsubjects.ChildClass
- static final String CLASS_NAME = "testsubjects.ChildClass"
+class MethodIntroduction extends AbstractPlasticSpecification {
- def instanceWithIntroducedMethod(MethodDescription md, isOverride)
- {
+ static final String CLASS_NAME = ChildClass.name
+
+ def instanceWithIntroducedMethod(MethodDescription md, isOverride) {
def mgr = createMgr({ PlasticClass pc ->
- if (pc.className == CLASS_NAME)
- {
+ if (pc.className == CLASS_NAME) {
def method = pc.introduceMethod(md)
assert method.override == isOverride
@@ -19,8 +18,7 @@ class MethodIntroduction extends Abstrac
return mgr.getClassInstantiator(CLASS_NAME).newInstance()
}
- def "introduce method not present in base class"()
- {
+ def "introduce method not present in base class"() {
def o = instanceWithIntroducedMethod(new MethodDescription(returnType, methodName), false)
@@ -53,8 +51,7 @@ class MethodIntroduction extends Abstrac
"double" | "getDouble" | { it.getDouble() } | 0d | Double
}
- def "introduce void method override"()
- {
+ def "introduce void method override"() {
setup:
@@ -69,8 +66,7 @@ class MethodIntroduction extends Abstrac
true
}
- def "introduce primitive method override"()
- {
+ def "introduce primitive method override"() {
setup:
def o = instanceWithIntroducedMethod(new MethodDescription("int", "primitiveMethod", "int"), true)
@@ -80,8 +76,7 @@ class MethodIntroduction extends Abstrac
o.primitiveMethod(97) == 97
}
- def "introduce object method override"()
- {
+ def "introduce object method override"() {
setup:
@@ -92,8 +87,7 @@ class MethodIntroduction extends Abstrac
o.objectMethod("plastic") == "plastic"
}
- def "introduce interface"()
- {
+ def "introduce interface"() {
def introduced
@@ -118,21 +112,18 @@ class MethodIntroduction extends Abstrac
introduced[0].methodName == "run"
}
- def "check for introduced interface is visible in subclasses"()
- {
+ def "check for introduced interface is visible in subclasses"() {
setup:
boolean present;
def mgr = createMgr({
PlasticClass pc ->
- if (pc.className.contains("Base"))
- {
+ if (pc.className.contains("Base")) {
pc.introduceInterface(Serializable)
}
- if (pc.className.contains("Child"))
- {
+ if (pc.className.contains("Child")) {
present = pc.isInterfaceImplemented(Serializable)
}
@@ -140,7 +131,7 @@ class MethodIntroduction extends Abstrac
when:
- mgr.getClassInstantiator("testsubjects.ChildClass")
+ mgr.getClassInstantiator(ChildClass.name)
then:
Modified: tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodProxying.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodProxying.groovy?rev=1308577&r1=1308576&r2=1308577&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodProxying.groovy (original)
+++ tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodProxying.groovy Mon Apr 2 21:24:37 2012
@@ -9,11 +9,11 @@ class MethodProxying extends AbstractPla
def mockRunnable = Mock(Runnable)
- def o = mgr.createClass (Object, { PlasticClass pc ->
+ def o = mgr.createClass(Object, { PlasticClass pc ->
- def field = pc.introduceField (Runnable, "delegate").inject(mockRunnable)
+ def field = pc.introduceField(Runnable, "delegate").inject(mockRunnable)
- pc.proxyInterface (Runnable, field)
+ pc.proxyInterface(Runnable, field)
} as PlasticClassTransformer).newInstance()
expect:
Modified: tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/ObtainPlasticClass.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/ObtainPlasticClass.groovy?rev=1308577&r1=1308576&r2=1308577&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/ObtainPlasticClass.groovy (original)
+++ tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/ObtainPlasticClass.groovy Mon Apr 2 21:24:37 2012
@@ -4,10 +4,12 @@ import org.apache.tapestry5.internal.pla
import java.lang.reflect.InvocationTargetException
+import testsubjects.*
+
class ObtainPlasticClass extends AbstractPlasticSpecification
{
def "abstract classes may not be instantiated"() {
- def pc = mgr.getPlasticClass("testsubjects.AbstractSubject")
+ def pc = mgr.getPlasticClass(AbstractSubject.name)
when:
@@ -22,7 +24,7 @@ class ObtainPlasticClass extends Abstrac
def "access to simple empty class"() {
setup:
- def pc = mgr.getPlasticClass("testsubjects.Empty")
+ def pc = mgr.getPlasticClass(Empty.name)
// More to come, but for now
@@ -34,7 +36,7 @@ class ObtainPlasticClass extends Abstrac
def "can obtain only method in class"() {
setup:
- def pc = mgr.getPlasticClass("testsubjects.SingleMethod")
+ def pc = mgr.getPlasticClass(SingleMethod.name)
def methods = pc.methods
expect:
@@ -44,7 +46,7 @@ class ObtainPlasticClass extends Abstrac
def "static methods are ignored"() {
setup:
- def pc = mgr.getPlasticClass("testsubjects.StaticMethodsIgnored")
+ def pc = mgr.getPlasticClass(StaticMethodsIgnored.name)
def methods = pc.methods
expect:
@@ -54,7 +56,7 @@ class ObtainPlasticClass extends Abstrac
def "methods obtained in sorted alphabetic order"() {
setup:
- def pc = mgr.getPlasticClass("testsubjects.MultipleMethods")
+ def pc = mgr.getPlasticClass(MultipleMethods.name)
def descs = pc.methods.collect({
it.description.toString()
});
@@ -74,7 +76,7 @@ class ObtainPlasticClass extends Abstrac
def "fields obtained in sorted alphabetic order"() {
setup:
- def pc = mgr.getPlasticClass("testsubjects.MultipleFields")
+ def pc = mgr.getPlasticClass(MultipleFields.name)
expect:
pc.fields.collect({ it.name }) == [
@@ -87,7 +89,7 @@ class ObtainPlasticClass extends Abstrac
def "static fields are ignored"() {
setup:
- def pc = mgr.getPlasticClass("testsubjects.StaticFields")
+ def pc = mgr.getPlasticClass(testsubjects.StaticFields.name)
expect:
pc.allFields == []
@@ -96,7 +98,7 @@ class ObtainPlasticClass extends Abstrac
def "instrumented instance fields must be private"() {
when:
- PlasticClass pc = mgr.getPlasticClass("testsubjects.PublicInstanceField")
+ PlasticClass pc = mgr.getPlasticClass(testsubjects.PublicInstanceField.name)
pc.getAllFields()[0].inject("fixed string value")
@@ -110,7 +112,7 @@ class ObtainPlasticClass extends Abstrac
def mgr = PlasticManager.withContextClassLoader().delegate(new NoopDelegate()).packages(["testsubjects"]).create()
- Class clazz = mgr.classLoader.loadClass("testsubjects.AlternateConstructor")
+ Class clazz = mgr.classLoader.loadClass(testsubjects.AlternateConstructor.name)
when:
Modified: tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/ParameterAnnotationsTest.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/ParameterAnnotationsTest.groovy?rev=1308577&r1=1308576&r2=1308577&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/ParameterAnnotationsTest.groovy (original)
+++ tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/ParameterAnnotationsTest.groovy Mon Apr 2 21:24:37 2012
@@ -1,13 +1,15 @@
package org.apache.tapestry5.plastic;
+
import org.apache.tapestry5.plastic.test.TestInject
+import testsubjects.ParameterAnnotationsSubject
public class ParameterAnnotationsTest extends AbstractPlasticSpecification {
def "parameter annotations are visible"() {
setup:
def mgr = createMgr()
- PlasticClass pc = mgr.getPlasticClass("testsubjects.ParameterAnnotationsSubject")
+ PlasticClass pc = mgr.getPlasticClass(ParameterAnnotationsSubject.name)
PlasticMethod pm = findMethod(pc, "theMethod")
when:
Modified: tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/SimpleClassLoading.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/SimpleClassLoading.groovy?rev=1308577&r1=1308576&r2=1308577&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/SimpleClassLoading.groovy (original)
+++ tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/SimpleClassLoading.groovy Mon Apr 2 21:24:37 2012
@@ -1,6 +1,7 @@
package org.apache.tapestry5.plastic
import testsubjects.InjectionSubject
+import testsubjects.InjectionSubjectSubclass
import testsubjects.TestInjectTransformer
import java.util.concurrent.Callable
@@ -20,12 +21,12 @@ class SimpleClassLoading extends Abstrac
def runnable = Mock(Runnable)
def transformer = new TestInjectTransformer(Runnable, runnable)
- def mgr = createMgr (transformer, {
- goHandle = findHandle (it, "go")
+ def mgr = createMgr(transformer, {
+ goHandle = findHandle(it, "go")
} as PlasticClassTransformer);
- def ins = mgr.getClassInstantiator ("testsubjects.InjectionSubject")
+ def ins = mgr.getClassInstantiator(InjectionSubject.name)
def instance = ins.newInstance()
when:
@@ -47,16 +48,16 @@ class SimpleClassLoading extends Abstrac
def runnable = Mock(Runnable)
def callable = Mock(Callable)
- def mgr = createMgr (
+ def mgr = createMgr(
new TestInjectTransformer(Runnable, runnable),
new TestInjectTransformer(Callable, callable), {
- if (goHandle ==null) goHandle = findHandle (it, "go")
+ if (goHandle == null) goHandle = findHandle(it, "go")
if (callHandle == null) callHandle = findHandle(it, "call")
} as PlasticClassTransformer)
- def ins = mgr.getClassInstantiator ("testsubjects.InjectionSubjectSubclass")
+ def ins = mgr.getClassInstantiator(InjectionSubjectSubclass.name)
def instance = ins.newInstance()
when:
Modified: tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/StaticFieldAccess.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/StaticFieldAccess.groovy?rev=1308577&r1=1308576&r2=1308577&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/StaticFieldAccess.groovy (original)
+++ tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/StaticFieldAccess.groovy Mon Apr 2 21:24:37 2012
@@ -1,25 +1,26 @@
package org.apache.tapestry5.plastic
import testinterfaces.Access
+import testsubjects.StaticFieldHolder
class StaticFieldAccess extends AbstractPlasticSpecification
{
def "static fields are readable and writable"()
{
setup:
- def pc = mgr.getPlasticClass("testsubjects.StaticFieldHolder")
+ def pc = mgr.getPlasticClass(StaticFieldHolder.name)
pc.introduceInterface(Access)
- pc.introduceMethod(new MethodDescription("java.lang.Object", "read")).changeImplementation({
+ pc.introduceMethod(new MethodDescription(Object.name, "read")).changeImplementation({
InstructionBuilder b ->
- b.getStaticField("testsubjects.StaticFieldHolder", "VALUE", String).returnResult()
+ b.getStaticField(StaticFieldHolder.name, "VALUE", String).returnResult()
} as InstructionBuilderCallback)
- pc.introduceMethod(new MethodDescription("void", "write", "java.lang.Object")).changeImplementation({
+ pc.introduceMethod(new MethodDescription(void.name, "write", "java.lang.Object")).changeImplementation({
InstructionBuilder b ->
b.loadArgument(0).checkcast(String)
- b.putStaticField("testsubjects.StaticFieldHolder", "VALUE", String).returnResult()
+ b.putStaticField(StaticFieldHolder.name, "VALUE", String).returnResult()
} as InstructionBuilderCallback)
Access o = pc.createInstantiator().newInstance()