void () { myFileDataProviderForSearch = new MyFileDataProviderForSearch(); myRangeSearch = new RangeSearch(new MockVirtualFile(FILE_NAME), getProject(), new MyRangeSearchCallback()); SearchTaskOptions options = new SearchTaskOptions(); options.setRegularExpression(true); options.setStringToFind(STRING_TO_FIND); myRangeSearch.runNewSearch(options, myFileDataProviderForSearch, false); // "false" turns on "the same thread" mode checkResults(); }