@Test
public void testFailureMode_MalformedFirstTransactionInFirstFile()
  throws Exception
{

  final Logger log = Logger.getLogger("TestTrailFilePositionSetter.testFailureMode_MalformedFirstTransactionInFirstFile");
  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,
                   100 /* corrupt first SCN */, "xyzzy", false, "");
  TrailFilePositionSetter posSetter = new TrailFilePositionSetter(dir.getAbsolutePath(), TRAIL_FILENAME_PREFIX);
  GGXMLTrailTransactionFinder finder = new GGXMLTrailTransactionFinder();
  FilePositionResult res;
  // SCN 100 is corrupted, so 101 is the effective oldest SCN => 100 treated as error:
  res = posSetter.locateFilePosition(100, finder);
  Assert.assertEquals(res.getStatus(), FilePositionResult.Status.ERROR,
                      "expected error for exact-match SCN that's corrupted and oldest in all trail files.");
  // SCN 101 is OK (regexQuery() doesn't fully validate XML):
  finder.reset();
  res = posSetter.locateFilePosition(TrailFilePositionSetter.USE_EARLIEST_SCN, finder);
  assertFilePositionResult(res, dir, 101, FilePositionResult.Status.FOUND);
  log.info(DONE_STRING);
}