Thanks a lot for the quick response!
Here is a new patch with the requested changes.
I added a method setOffsetGap(..) and getOffsetGap() to MockAnalyzer and now set the offsetGap random in the test, which sort of tests the gapOffset as well. I did not add a separate test for the offsetGap though. Can you hint at what exactly I should be testing?
Also, I found that the String parameter for MockAnalyzer.setPositionIncrementGap is not really used. I added it to setOffsetGap for consistency but it makes no sense. Should it be removed?
I close everything now that has a close method. I am now a little surprised that the missing closes caused no test failure in the original patch. Could this be a problem?