assert the IOE is correctcheck

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1529650 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2013-10-06 17:27:09 +00:00
parent cffeb29a10
commit f514b787e6
1 changed files with 5 additions and 4 deletions

View File

@ -1218,6 +1218,9 @@ public class TestIndexWriterDelete extends LuceneTestCase {
d.close(); d.close();
} }
private static class FakeIOException extends IOException {
}
// Make sure if we hit disk full, and then later disk // Make sure if we hit disk full, and then later disk
// frees up, and we successfully close IW or open an NRT // frees up, and we successfully close IW or open an NRT
// reader, we don't lose any deletes: // reader, we don't lose any deletes:
@ -1232,8 +1235,6 @@ public class TestIndexWriterDelete extends LuceneTestCase {
final AtomicBoolean shouldFail = new AtomicBoolean(); final AtomicBoolean shouldFail = new AtomicBoolean();
dir.failOn(new MockDirectoryWrapper.Failure() { dir.failOn(new MockDirectoryWrapper.Failure() {
boolean failedAlready;
@Override @Override
public void eval(MockDirectoryWrapper dir) throws IOException { public void eval(MockDirectoryWrapper dir) throws IOException {
StackTraceElement[] trace = new Exception().getStackTrace(); StackTraceElement[] trace = new Exception().getStackTrace();
@ -1249,7 +1250,7 @@ public class TestIndexWriterDelete extends LuceneTestCase {
new Throwable().printStackTrace(System.out); new Throwable().printStackTrace(System.out);
} }
shouldFail.set(false); shouldFail.set(false);
throw new IOException("now fail on purpose"); throw new FakeIOException();
} else { } else {
break; break;
} }
@ -1292,7 +1293,7 @@ public class TestIndexWriterDelete extends LuceneTestCase {
} }
w.close(); w.close();
} catch (IOException ioe) { } catch (FakeIOException ioe) {
// expected // expected
if (VERBOSE) { if (VERBOSE) {
System.out.println("TEST: w.close() hit expected IOE"); System.out.println("TEST: w.close() hit expected IOE");