@Test
public void testLongErrorMessage() throws IOException {

  File makefile = temporaryFolder.newFile("CMakeLists.txt");
  String errorMessage = "CMake Error at %s:49 (message): %s";
  String loremIpsum =
    "Lorem ipsum dolor\n"
    + "amet, consectetur adipiscing elit.  Etiam ac aliquam lacus.  Nullam suscipit nisl\n"
    + "vitae sodales varius.  Donec eu enim ante.  Maecenas congue ante a nibh tristique,\n"
    + "in sagittis velit suscipit.  Ut hendrerit molestie augue quis sodales.  Praesent ac\n"
    + "consectetur est.  Duis at auctor neque.";
  errorMessage =
    String.format(
      Locale.getDefault(), errorMessage, makefile.getAbsolutePath(), loremIpsum);
  BuildOutputInstantReader reader = new TestBuildOutputInstantReader(errorMessage);
  ArgumentCaptor<BuildEvent> captor = ArgumentCaptor.forClass(BuildEvent.class);
  assertThat(parser.parse(reader.readLine(), reader, messageConsumer)).isTrue();
  verify(messageConsumer).accept(captor.capture());
  assertThat(captor.getAllValues()).hasSize(1);
  verifyFileMessageEvent(captor.getAllValues().get(0), makefile.getAbsolutePath(), "CMake errors", MessageEvent.Kind.ERROR, 49, 0);
}