LUCENE-6271: fix another test bug (happens in nightly more often) unrelated to this branch

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene6271@1670525 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2015-04-01 00:29:21 +00:00
parent 10565e237d
commit 87b3bfaee4
1 changed files with 7 additions and 0 deletions

View File

@ -28,6 +28,7 @@ import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
@ -957,12 +958,18 @@ public class TestLRUQueryCache extends LuceneTestCase {
BadQuery query = new BadQuery();
searcher.count(query);
query.i[0] += 1; // change the hashCode!
try {
// trigger an eviction
searcher.count(new MatchAllDocsQuery());
fail();
} catch (ConcurrentModificationException e) {
// expected
} catch (RuntimeException e) {
// expected: wrapped when executor is in use
Throwable cause = e.getCause();
assertTrue(cause instanceof ExecutionException);
assertTrue(cause.getCause() instanceof ConcurrentModificationException);
}
IOUtils.close(w, reader, dir);