@Test
public void testReplaceLongWord() throws Exception {

  Diacriticizer diacriticizer = mock(Diacriticizer.class);
  when(diacriticizer.diacriticize("Aujourd'hui")).thenReturn(new HashSet<>(Arrays.asList("aujourd'hui")));
  when(diacriticizer.diacriticize("Parce que")).thenReturn(new HashSet<>(Arrays.asList("parce que")));
  
  System.setProperty("config.file", "src/test/resources/test.conf");
  ConfigFactory.invalidateCaches();
  final Config config = ConfigFactory.load();
  final String sessionId = "test";
  TalismaneSession.get(sessionId).setDiacriticizer(diacriticizer);
  LowercaseKnownFirstWordFilter filter = new LowercaseKnownFirstWordFilter(sessionId);
  String text = "Aujourd'hui il vient. Parce que...";
  Sentence sentence = new Sentence(text, sessionId);
  TokenSequence tokenSequence = new TokenSequence(sentence, sessionId);
  tokenSequence.addToken("".length(), "Aujourd'hui".length());
  tokenSequence.addToken("Aujourd'hui ".length(), "Aujourd'hui il".length());
  tokenSequence.addToken("Aujourd'hui il ".length(), "Aujourd'hui il vient".length());
  tokenSequence.addToken("Aujourd'hui il vient".length(), "Aujourd'hui il vient.".length());
  tokenSequence.addToken("Aujourd'hui il vient. ".length(), "Aujourd'hui il vient. Parce que".length());
  tokenSequence.addToken("Aujourd'hui il vient. Parce que".length(), "Aujourd'hui il vient. Parce que...".length());
  filter.apply(tokenSequence);
  System.out.println(tokenSequence);
  StringBuilder sb = new StringBuilder();
  for (Token token : tokenSequence) {
    sb.append(token.getText());
    sb.append('|');
  }
  assertEquals("aujourd'hui|il|vient|.|parce que|...|", sb.toString());
}