final ErlangSearchPattern pattern = new SearchPatternFactory(ErlangEngine
.getInstance().getModelUtilService()).getSearchPattern(
SearchFor.VARIABLE, null, "A", 0, LimitTo.ALL_OCCURRENCES, moduleA);
final ErlSearchScope scope = new ErlSearchScope(moduleA, moduleB);
final ErlSearchScope reducedScope = pattern.reduceScope(scope);
final ErlSearchQuery query = new ErlSearchQuery(pattern, reducedScope, "");
query.run(new NullProgressMonitor());
// then
// it should be found in module a
final ErlangSearchResult searchResult = (ErlangSearchResult) query
.getSearchResult();
assertEquals(2, searchResult.getMatchCount());
final List<ErlangSearchElement> result = searchResult.getResult();
assertTrue(hasModule(moduleA, result));
assertFalse(hasModule(moduleB, result));