@Override
      protected Writer createWriter(Path logfile) throws IOException {
        Writer mockWriter = Mockito.mock(Writer.class);
        Mockito.doAnswer(new Answer<Void>() {
          int expectedIndex = 0;

          @Override
          public Void answer(InvocationOnMock invocation) {
            if (writerSlowness > 0) {
              try {
                Thread.sleep(writerSlowness);
              } catch (InterruptedException ie) {
                Thread.currentThread().interrupt();
              }
            }
            Entry entry = (Entry) invocation.getArgument(0);
            WALEdit edit = entry.getEdit();
            List<Cell> cells = edit.getCells();
            assertEquals(1, cells.size());
            Cell cell = cells.get(0);

            // Check that the edits come in the right order.
            assertEquals(expectedIndex,
              Bytes.toInt(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength()));
            expectedIndex++;
            return null;
          }
        }).when(mockWriter).append(Mockito.<Entry> any());
        return mockWriter;
      }
Sets up a log splitter with a mock reader and writer. The mock reader generates a specified
number of edits spread across 5 regions. The mock writer optionally sleeps for each edit it is
fed. After the split is complete, verifies that the statistics show the correct number of edits
output into each region.
@param numFakeEdits   number of fake edits to push through pipeline
@param bufferSize     size of in-memory buffer
@param writerSlowness writer threads will sleep this many ms per edit
hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALSplit.java