You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2008/05/14 02:53:18 UTC

svn commit: r656069 - /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/transform/InjectComponentWorkerTest.java

Author: hlship
Date: Tue May 13 17:53:18 2008
New Revision: 656069

URL: http://svn.apache.org/viewvc?rev=656069&view=rev
Log:
TAPESTRY-2370: When injecting a component into a field and the type is not a match the exception report is not sufficiently helpful

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/transform/InjectComponentWorkerTest.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/transform/InjectComponentWorkerTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/transform/InjectComponentWorkerTest.java?rev=656069&r1=656068&r2=656069&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/transform/InjectComponentWorkerTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/transform/InjectComponentWorkerTest.java Tue May 13 17:53:18 2008
@@ -21,6 +21,8 @@
 import org.apache.tapestry.services.ComponentClassTransformWorker;
 import org.apache.tapestry.services.TransformConstants;
 import org.apache.tapestry.test.TapestryTestCase;
+import static org.easymock.EasyMock.contains;
+import static org.easymock.EasyMock.same;
 import org.testng.annotations.Test;
 
 public class InjectComponentWorkerTest extends TapestryTestCase
@@ -43,8 +45,9 @@
         expect(annotation.value()).andReturn("");
         ct.makeReadOnly("myfield");
 
-        train_extendMethod(ct, TransformConstants.CONTAINING_PAGE_DID_LOAD_SIGNATURE,
-                           "myfield = (" + CLASS_NAME + ") resources.getEmbeddedComponent(\"myfield\");");
+        ct.extendMethod(same(TransformConstants.CONTAINING_PAGE_DID_LOAD_SIGNATURE),
+                        contains(
+                                "myfield = (" + CLASS_NAME + ") resources.getEmbeddedComponent(\"myfield\");"));
 
 
         replay();
@@ -68,8 +71,10 @@
         train_getResourcesFieldName(ct, "resources");
         expect(annotation.value()).andReturn("id_provided_as_annotation").atLeastOnce();
         ct.makeReadOnly("myfield");
-        train_extendMethod(ct, TransformConstants.CONTAINING_PAGE_DID_LOAD_SIGNATURE,
-                           "myfield = (" + CLASS_NAME + ") resources.getEmbeddedComponent(\"id_provided_as_annotation\");");
+
+        ct.extendMethod(same(TransformConstants.CONTAINING_PAGE_DID_LOAD_SIGNATURE),
+                        contains(
+                                "myfield = (" + CLASS_NAME + ") resources.getEmbeddedComponent(\"id_provided_as_annotation\");"));
 
         replay();