@Test
public void testApplyWithUnmatchingGroups() throws Exception {

  System.setProperty("config.file", "src/test/resources/test.conf");
  ConfigFactory.invalidateCaches();
  final Config config = ConfigFactory.load();
  final String sessionId = "test";
  String regex = "\\b(\\d)(\\d)?\\b";
  String replacement = "Number$1$2";
  RegexTokenAnnotator filter = new RegexTokenAnnotator(regex, replacement, null, sessionId);
  Sentence text = new Sentence("Two-digit number: 42. One-digit number: 7.", sessionId);
  filter.annotate(text);
  List<Annotation<TokenPlaceholder>> placeholders = text.getAnnotations(TokenPlaceholder.class);
  LOG.debug(placeholders.toString());
  assertEquals(2, placeholders.size());
  Annotation<TokenPlaceholder> placeholder = placeholders.get(0);
  assertEquals("Two-digit number: ".length(), placeholder.getStart());
  assertEquals("Two-digit number: 42".length(), placeholder.getEnd());
  assertEquals("Number42", placeholder.getData().getReplacement());
  placeholder = placeholders.get(1);
  assertEquals("Two-digit number: 42. One-digit number: ".length(), placeholder.getStart());
  assertEquals("Two-digit number: 42. One-digit number: 7".length(), placeholder.getEnd());
  assertEquals("Number7", placeholder.getData().getReplacement());
}