org.apache.lucene.store

## Class MockDirectoryWrapper.Failure

- java.lang.Object
- - org.apache.lucene.store.MockDirectoryWrapper.Failure

Enclosing class:
  MockDirectoryWrapper

    public static class MockDirectoryWrapper.Failure
    extends Object

Objects that represent fail-able conditions. Objects of a derived class are created and registered with the mock directory. After register, each object will be invoked once for each first write of a file, giving the object a chance to throw an IOException.

### Field Summary

Fields
`protected boolean` `doFail`

### Constructor Summary

Constructors
Constructor and Description
`MockDirectoryWrapper.Failure()`

### Method Summary

Methods
`void` `clearDoFail()`
`void` `eval(MockDirectoryWrapper dir)` eval is called on the first write of every new file.
`MockDirectoryWrapper.Failure` `reset()` reset should set the state of the failure to its default (freshly constructed) state.
`void` `setDoFail()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### doFail

    protected boolean doFail

### Constructor Detail

#### MockDirectoryWrapper.Failure

    public MockDirectoryWrapper.Failure()

### Method Detail

#### eval

    public void eval(MockDirectoryWrapper dir)
              throws IOException

eval is called on the first write of every new file.

Throws:
  `IOException`

#### reset

    public MockDirectoryWrapper.Failure reset()

reset should set the state of the failure to its default (freshly constructed) state. Reset is convenient for tests that want to create one failure object and then reuse it in multiple cases. This, combined with the fact that Failure subclasses are often anonymous classes makes reset difficult to do otherwise. A typical example of use is Failure failure = new Failure() { ... }; ... mock.failOn(failure.reset())

#### setDoFail

    public void setDoFail()

#### clearDoFail

    public void clearDoFail()