You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2016/04/20 23:23:18 UTC

wicket git commit: WICKET-6053 Allow to reuse the same application instance in several tests

Repository: wicket
Updated Branches:
  refs/heads/master f291a585a -> 68d35c227


WICKET-6053 Allow to reuse the same application instance in several tests


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

Branch: refs/heads/master
Commit: 68d35c2276227c0ca3d0b449c3e71f7143fd013b
Parents: f291a58
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed Apr 20 23:22:56 2016 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Apr 20 23:22:56 2016 +0200

----------------------------------------------------------------------
 .../apache/wicket/util/tester/BaseWicketTester.java   | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/68d35c22/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 4266f6c..910ad80 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
@@ -322,19 +322,15 @@ public class BaseWicketTester
 
 		this.application = application;
 
-		// If it's provided from the container it's not necessary to set again.
-		if (init)
-		{
-			// FIXME some tests are leaking applications by not calling destroy on them or overriding
-			// teardown() without calling super, for now we work around by making each name unique
-			application.setName("WicketTesterApplication-" + UUID.randomUUID());
-		}
-
 		ThreadContext.setApplication(application);
 
-		// If it's provided from the container it's not necessary to set again and init.
 		if (init)
 		{
+			if (application.getName() == null)
+			{
+				application.setName("WicketTesterApplication-" + UUID.randomUUID());
+			}
+			
 			application.setServletContext(servletContext);
 			// initialize the application
 			application.initApplication();