diff --git a/plugins/git4idea/testFramework/git4idea/remote/GitHttpAuthTestService.java b/plugins/git4idea/testFramework/git4idea/remote/GitHttpAuthTestService.java index 2224b88232fe..243734ac68f2 100644 --- a/plugins/git4idea/testFramework/git4idea/remote/GitHttpAuthTestService.java +++ b/plugins/git4idea/testFramework/git4idea/remote/GitHttpAuthTestService.java @@ -28,7 +28,7 @@ import org.jetbrains.annotations.Nullable; */ public class GitHttpAuthTestService extends GitHttpAuthService { - @NotNull private GitHttpAuthenticator myAuthenticator = new GitHttpAuthenticator() { + public static final GitHttpAuthenticator STUB_AUTHENTICATOR = new GitHttpAuthenticator() { @NotNull @Override public String askPassword(@NotNull String url) { @@ -52,6 +52,8 @@ public class GitHttpAuthTestService extends GitHttpAuthService { } }; + @NotNull private GitHttpAuthenticator myAuthenticator = STUB_AUTHENTICATOR; + @NotNull @Override public GitHttpAuthenticator createAuthenticator(@NotNull Project project, @Nullable ModalityState state, @NotNull GitCommand command, @@ -63,4 +65,8 @@ public class GitHttpAuthTestService extends GitHttpAuthService { myAuthenticator = authenticator; } + public void cleanup() { + myAuthenticator = STUB_AUTHENTICATOR; + } + } diff --git a/plugins/git4idea/testFramework/git4idea/test/TestDialogManager.java b/plugins/git4idea/testFramework/git4idea/test/TestDialogManager.java index 513c4f964cf3..3498e6edf1a6 100644 --- a/plugins/git4idea/testFramework/git4idea/test/TestDialogManager.java +++ b/plugins/git4idea/testFramework/git4idea/test/TestDialogManager.java @@ -53,4 +53,8 @@ public class TestDialogManager extends DialogManager { myHandlers.put(dialogClass, handler); } + public void cleanup() { + myHandlers.clear(); + } + } diff --git a/plugins/git4idea/testFramework/git4idea/test/TestNotificator.java b/plugins/git4idea/testFramework/git4idea/test/TestNotificator.java index 5ec1af3ae81c..e8ad4f749191 100644 --- a/plugins/git4idea/testFramework/git4idea/test/TestNotificator.java +++ b/plugins/git4idea/testFramework/git4idea/test/TestNotificator.java @@ -78,4 +78,7 @@ public class TestNotificator extends Notificator { myLastNotification = createNotification(notificationGroup, title, message, type, listener); } + public void cleanup() { + myLastNotification = null; + } } diff --git a/plugins/github/test/org/jetbrains/plugins/github/test/GithubTest.java b/plugins/github/test/org/jetbrains/plugins/github/test/GithubTest.java index 49ffb7745997..0e90e3013e2b 100644 --- a/plugins/github/test/org/jetbrains/plugins/github/test/GithubTest.java +++ b/plugins/github/test/org/jetbrains/plugins/github/test/GithubTest.java @@ -37,7 +37,6 @@ import git4idea.test.TestDialogManager; import git4idea.test.TestNotificator; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.plugins.github.GithubAuthData; import org.jetbrains.plugins.github.GithubSettings; import static org.junit.Assume.assumeNotNull; @@ -63,6 +62,7 @@ public abstract class GithubTest extends UsefulTestCase { @NotNull protected VirtualFile myProjectRoot; @NotNull protected GitVcsSettings myGitSettings; @NotNull protected GithubSettings myGitHubSettings; + @NotNull private GitHttpAuthTestService myHttpAuthService; @NotNull protected TestDialogManager myDialogManager; @NotNull protected TestNotificator myNotificator; @@ -163,10 +163,15 @@ public abstract class GithubTest extends UsefulTestCase { myDialogManager = (TestDialogManager)ServiceManager.getService(DialogManager.class); myNotificator = (TestNotificator)ServiceManager.getService(myProject, Notificator.class); + myHttpAuthService = (GitHttpAuthTestService)ServiceManager.getService(GitHttpAuthService.class); } @Override protected void tearDown() throws Exception { + myHttpAuthService.cleanup(); + myDialogManager.cleanup(); + myNotificator.cleanup(); + myProjectFixture.tearDown(); super.tearDown(); }