@Test
public void parseWithErrorIgnoreOutput() {

  String line =
    "AGPBI: {\"kind\":\"error\",\"text\":\"Error message.\",\"sources\":[{}],\"original\":\"Error line 1\\nError line 2\\nError line 3\",\"tool\":\"Dex\"}";
  when(myReader.getParentEventId()).thenReturn("BUILD_ID_MOCK");
  ArgumentCaptor<MessageEvent> messageCaptor = ArgumentCaptor.forClass(MessageEvent.class);
  String[] detailLines = new String[5];
  detailLines[0] = "Error line 1";
  detailLines[1] = "Error line 2";
  detailLines[2] = "Error line 3";
  detailLines[3] = "Unrelated output";
  detailLines[4] = "Error line 1";
  assertTrue(myParser.parse(line, myReader, myConsumer));
  assertTrue(myParser.parse(detailLines[0], myReader, myConsumer));
  assertTrue(myParser.parse(detailLines[1], myReader, myConsumer));
  assertTrue(myParser.parse(detailLines[2], myReader, myConsumer));
  assertFalse(myParser.parse(detailLines[3], myReader, myConsumer));
  assertFalse(myParser.parse(detailLines[4], myReader, myConsumer));
  verify(myConsumer).accept(messageCaptor.capture());
  List<MessageEvent> generatedMessages = messageCaptor.getAllValues();
  assertThat(generatedMessages).hasSize(1);
  assertThat(generatedMessages.get(0)).isNotInstanceOf(FileMessageEvent.class);
  MessageEvent messageEvent = generatedMessages.get(0);
  assertThat(messageEvent.getGroup()).isEqualTo("Dex errors");
  assertThat(messageEvent.getKind()).isEqualTo(MessageEvent.Kind.ERROR);
  assertThat(messageEvent.getResult().getDetails()).isEqualTo("Error line 1\nError line 2\nError line 3");
}