join thread in tests to avoid thread leaks

This commit is contained in:
Alexey Kudravtsev
2015-11-13 13:52:35 +03:00
parent 2ba20ccf45
commit 2b999838c8
16 changed files with 218 additions and 269 deletions
@@ -99,7 +99,7 @@ public class FindManagerTest extends DaemonAnalyzerTestCase {
super.tearDown();
}
public void testFindString() {
public void testFindString() throws InterruptedException {
FindModel findModel = FindManagerTestUtils.configureFindModel("done");
String text = "public static class MyClass{\n/*done*/\npublic static void main(){}}";
@@ -149,7 +149,7 @@ public class FindManagerTest extends DaemonAnalyzerTestCase {
findModel.setProjectScope(true);
final FindResult[] findResultArr = new FindResult[1];
findInNewThread(findModel, myFindManager, text, 0, findResultArr);
Thread thread = findInNewThread(findModel, myFindManager, text, 0, findResultArr);
new WaitFor(30 *1000){
@Override
protected boolean condition() {
@@ -158,6 +158,7 @@ public class FindManagerTest extends DaemonAnalyzerTestCase {
}.assertCompleted();
assertFalse(findResultArr[0].isStringFound());
thread.join();
}
private static Thread findInNewThread(final FindModel model,