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 3d3d8201e03a..80930814c791 100644 --- a/plugins/github/test/org/jetbrains/plugins/github/test/GithubTest.java +++ b/plugins/github/test/org/jetbrains/plugins/github/test/GithubTest.java @@ -176,17 +176,19 @@ public abstract class GithubTest extends GitPlatformTest { myHttpAuthService = (GitHttpAuthTestService)ServiceManager.getService(GitHttpAuthService.class); - try { beforeTest(); } catch (Exception e) { try { - tearDown(); + afterTest(); } catch (Exception e2) { e2.printStackTrace(); } + finally { + cleanup(); + } throw e; } } @@ -197,11 +199,15 @@ public abstract class GithubTest extends GitPlatformTest { afterTest(); } finally { - myHttpAuthService.cleanup(); + cleanup(); super.tearDown(); } } + private void cleanup() { + if (myHttpAuthService != null) myHttpAuthService.cleanup(); + } + protected void beforeTest() throws Exception { }