@Test
public void testGetRawTextBlock() throws Exception {

  System.setProperty("config.file", "src/test/resources/test.conf");
  ConfigFactory.invalidateCaches();
  final Config config = ConfigFactory.load();
  final String sessionId = "test";
  String[] labels = new String[0];
  RollingTextBlock textBlock = new RollingTextBlock(true, null, sessionId);
  textBlock = textBlock.roll("1 ");
  textBlock = textBlock.roll("2 ");
  textBlock = textBlock.roll("3<skip>skip</skip> 4<sk");
  textBlock = textBlock.roll("ip>skip</skip> 5");
  // the rawTextBlock always contains the last two added sub-blocks
  // so annotations are relative to these sub-blocks
  AnnotatedText rawTextBlock = textBlock.getRawTextBlock();
  List<Annotation<RawTextSkipMarker>> skips = new ArrayList<>();
  skips.add(new Annotation<>("3".length(), "3<skip>skip</skip>".length(), new RawTextSkipMarker("me"), labels));
  skips.add(new Annotation<>("3<skip>skip</skip> 4".length(), "3<skip>skip</skip> 4<skip>skip</skip>".length(), new RawTextSkipMarker("me"), labels));
  rawTextBlock.addAnnotations(skips);
  List<Annotation<RawTextSkipMarker>> sourceSkips = textBlock.getAnnotations(RawTextSkipMarker.class);
  System.out.println(sourceSkips.toString());
  assertEquals(2, sourceSkips.size());
  int i = 0;
  // ensure annotations are placed correctly - they need to take into
  // account blocks 1 and 2
  for (Annotation<RawTextSkipMarker> skip : sourceSkips) {
    if (i == 0) {
      assertEquals("1 2 3".length(), skip.getStart());
      assertEquals("1 2 3<skip>skip</skip>".length(), skip.getEnd());
    } else if (i == 1) {
      assertEquals("1 2 3<skip>skip</skip> 4".length(), skip.getStart());
      assertEquals("1 2 3<skip>skip</skip> 4<skip>skip</skip>".length(), skip.getEnd());
    }
    i++;
  }
}