Program: 41803
Project: 41803
Buggy source:
@Test public void testWasPadding() throws IOException {
  final String basePath=TMP + "String_Node_Str";
  ChronicleTools.deleteOnExit(basePath);
  ChronicleConfig config=ChronicleConfig.TEST.clone();
  config.dataBlockSize(128);
  config.indexBlockSize(128);
  IndexedChronicle chronicle1=new IndexedChronicle(basePath,config);
  ExcerptAppender appender=chronicle1.createAppender();
  IndexedChronicle chronicle2=new IndexedChronicle(basePath,config);
  ExcerptTailer tailer=chronicle2.createTailer();
  assertEquals(-1,tailer.index());
  assertTrue(tailer.wasPadding());
  assertFalse(tailer.index(-1));
  assertTrue(tailer.wasPadding());
  appender.startExcerpt(48);
  appender.position(48);
  appender.finish();
  assertTrue(tailer.nextIndex());
  assertFalse(tailer.wasPadding());
  assertEquals(0,tailer.index());
  assertTrue(tailer.index(0));
  assertFalse(tailer.wasPadding());
  assertFalse(tailer.nextIndex());
  assertFalse(tailer.wasPadding());
  assertEquals(0,tailer.index());
  assertFalse(tailer.index(1));
  assertFalse(tailer.wasPadding());
  appender.startExcerpt(48);
  appender.position(48);
  appender.finish();
  assertTrue(tailer.nextIndex());
  assertFalse(tailer.wasPadding());
  assertEquals(2,tailer.index());
  assertTrue(tailer.index(1));
  assertFalse(tailer.wasPadding());
  assertEquals(1,tailer.index());
  assertFalse(tailer.nextIndex());
  assertFalse(tailer.wasPadding());
  assertEquals(1,tailer.index());
  assertFalse(tailer.index(2));
  assertFalse(tailer.wasPadding());
  assertEquals(2,tailer.index());
  appender.startExcerpt(48);
  appender.position(48);
  appender.finish();
  assertFalse(tailer.index(2));
  assertTrue(tailer.wasPadding());
  assertEquals(2,tailer.index());
  assertTrue(tailer.index(1));
  assertTrue(tailer.nextIndex());
  assertFalse(tailer.wasPadding());
  assertEquals(3,tailer.index());
  assertFalse(tailer.index(2));
  assertTrue(tailer.wasPadding());
  assertEquals(2,tailer.index());
  assertTrue(tailer.index(3));
  assertFalse(tailer.wasPadding());
  assertEquals(3,tailer.index());
  assertFalse(tailer.index(4));
  assertFalse(tailer.wasPadding());
  assertEquals(4,tailer.index());
  chronicle1.close();
  chronicle2.close();
}

Fixed version (ground truth):
@Test public void testWasPadding() throws IOException {
  final String basePath=TMP + "String_Node_Str";
  ChronicleTools.deleteOnExit(basePath);
  ChronicleConfig config=ChronicleConfig.TEST.clone();
  config.dataBlockSize(128);
  config.indexBlockSize(128);
  IndexedChronicle chronicle1=new IndexedChronicle(basePath,config);
  ExcerptAppender appender=chronicle1.createAppender();
  IndexedChronicle chronicle2=new IndexedChronicle(basePath,config);
  ExcerptTailer tailer=chronicle2.createTailer();
  assertEquals(-1,tailer.index());
  assertTrue(tailer.wasPadding());
  assertFalse(tailer.index(-1));
  assertTrue(tailer.wasPadding());
  appender.startExcerpt(48);
  appender.position(48);
  appender.finish();
  assertTrue(tailer.nextIndex());
  assertFalse(tailer.wasPadding());
  assertEquals(0,tailer.index());
  assertTrue(tailer.index(0));
  assertFalse(tailer.wasPadding());
  assertFalse(tailer.index(-1));
  assertEquals(-1,tailer.index());
  assertTrue(tailer.nextIndex());
  assertFalse(tailer.wasPadding());
  assertEquals(0,tailer.index());
  assertFalse(tailer.nextIndex());
  assertFalse(tailer.wasPadding());
  assertEquals(0,tailer.index());
  assertFalse(tailer.index(1));
  assertFalse(tailer.wasPadding());
  appender.startExcerpt(48);
  appender.position(48);
  appender.finish();
  assertTrue(tailer.nextIndex());
  assertFalse(tailer.wasPadding());
  assertEquals(2,tailer.index());
  assertTrue(tailer.index(1));
  assertFalse(tailer.wasPadding());
  assertEquals(1,tailer.index());
  assertFalse(tailer.nextIndex());
  assertFalse(tailer.wasPadding());
  assertEquals(1,tailer.index());
  assertFalse(tailer.index(2));
  assertFalse(tailer.wasPadding());
  assertEquals(2,tailer.index());
  appender.startExcerpt(48);
  appender.position(48);
  appender.finish();
  assertFalse(tailer.index(2));
  assertTrue(tailer.wasPadding());
  assertEquals(2,tailer.index());
  assertTrue(tailer.index(1));
  assertTrue(tailer.nextIndex());
  assertFalse(tailer.wasPadding());
  assertEquals(3,tailer.index());
  assertFalse(tailer.index(2));
  assertTrue(tailer.wasPadding());
  assertEquals(2,tailer.index());
  assertTrue(tailer.index(3));
  assertFalse(tailer.wasPadding());
  assertEquals(3,tailer.index());
  assertFalse(tailer.index(4));
  assertFalse(tailer.wasPadding());
  assertEquals(4,tailer.index());
  chronicle1.close();
  chronicle2.close();
}