github: fix test

* fix NPE on tearDown()
* do not call super.tearDown() on exception in beforeTest()
This commit is contained in:
Aleksey Pivovarov
2014-08-28 20:52:16 +04:00
parent 4ba408f5f2
commit 30d26a2cc9
@@ -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 {
}