@Test
public void testFailureMode_MalformedLastTransactionInMiddleFile()
  throws Exception
{

  final Logger log = Logger.getLogger("TestTrailFilePositionSetter.testFailureMode_MalformedLastTransactionInMiddleFile");
  log.info("starting");
  File dir = createTempDir();
  // first SCN is hardcoded always to be 100
  createTrailFiles(dir.getAbsolutePath(), TRAIL_FILENAME_PREFIX, 150 /* numTxns, 24 lines each */,
                   1250 /* numLinesPerFile */, 1 /* numLinesPerNewline */, "\n", 0,
                   307 /* corrupt last SCN in 2nd file */, "plugh", false, "");
  TrailFilePositionSetter posSetter = new TrailFilePositionSetter(dir.getAbsolutePath(), TRAIL_FILENAME_PREFIX);
  GGXMLTrailTransactionFinder finder = new GGXMLTrailTransactionFinder();
  FilePositionResult res;
  // corruption at SCN 307 occurs after SCN 299, so latter should be found OK:
  res = posSetter.locateFilePosition(299, finder);
  assertFilePositionResult(res, dir, 299, FilePositionResult.Status.FOUND);
  // SCN 306 is in same transaction as 307, but regexQuery() doesn't fully validate XML => OK
  finder.reset();
  res = posSetter.locateFilePosition(306, finder);
  assertFilePositionResult(res, dir, 306, FilePositionResult.Status.FOUND);
  log.info(DONE_STRING);
}