Addressing pull request #224 comments

Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/717dc339
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/717dc339
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/717dc339

Branch: refs/heads/master
Commit: 717dc339d8ef416c52f86a6af3b0a4ac53d5594e
Parents: aeda988
Author: Domas Poliakas <dpoliakas@Domas-MBP.local>
Authored: Thu Jul 27 14:58:48 2017 +0100
Committer: Martin Tzvetanov Grigorov <mgrigo...@apache.org>
Committed: Sun Aug 6 15:27:21 2017 +0300

----------------------------------------------------------------------
 .../wicket/util/tester/BaseWicketTester.java    | 24 ++++++++++++--------
 1 file changed, 15 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/717dc339/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java 
b/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
index 13c16fb..2f17a64 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
@@ -2328,21 +2328,27 @@ public class BaseWicketTester
                failMessage = "Component wasn't found in the AJAX response. " + 
componentInfo;
                result = isTrue(failMessage, isComponentInAjaxResponse);
 
-               // Check if the component has been included as part of an 
enclosure render
-               Enclosure enclosure = 
getLastRenderedPage().visitChildren(Enclosure.class, (Enclosure enc, 
IVisit<Enclosure> visit) -> {
-                       if 
(AjaxEnclosureListener.isControllerOfEnclosure(component, enc)){
-                               visit.stop(enc);
+               if (result.wasFailed()){
+                       // Check if the component has been included as part of 
an enclosure render
+                       Enclosure enclosure = 
getLastRenderedPage().visitChildren(Enclosure.class, (Enclosure enc, 
IVisit<Enclosure> visit) -> {
+                               if 
(AjaxEnclosureListener.isControllerOfEnclosure(component, enc)){
+                                       visit.stop(enc);
+                               }
+                       });
+
+                       if (enclosure != null){
+                               failMessage = "Component's enclosure was not 
found in the AJAX response. " + enclosure;
+                               boolean isEnclosureInAjaxResponse = 
!isComponentOnAjaxResponse(enclosure).wasFailed();
+                               return isTrue(failMessage, 
isEnclosureInAjaxResponse);
+                       } else {
+                               return result;
                        }
-               });
 
-               if (enclosure != null){
-                       failMessage = "Component's enclosure was not found in 
the AJAX response. " + enclosure.toString();
-                       boolean isEnclosureInAjaxResponse = 
!isComponentOnAjaxResponse(enclosure).wasFailed();
-                       return isTrue(failMessage, isEnclosureInAjaxResponse);
                } else {
                        return result;
                }
 
+
        }
 
        /**

Reply via email to