@Test
public void duplicateResources2() throws Exception {

  File file1 = File.createTempFile(BuildOutputParserTest.class.getName(), DOT_XML);
  File file2 = File.createTempFile(BuildOutputParserTest.class.getName(), DOT_XML);
  String path1 = file1.getPath();
  String path2 = file2.getPath();
  Files.write(
    "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
    "<resources xmlns:ns1=\"urn:oasis:names:tc:xliff:document:1.2\">\n" +
    "    <!-- This is just a comment: group2_string -->" +
    "    <item name=\"group1\" type=\"id\"/>\n" +
    "    <string name=\"group2_string\">Hello</string>\n" +
    "\n" +
    "</resources>\n", file1, StandardCharsets.UTF_8);
  Files.write(
    "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
    "<resources xmlns:ns1=\"urn:oasis:names:tc:xliff:document:1.2\">\n" +
    "    <item type=\"string\" name=\"group2_string\">Hello</item>\n" +
    "</resources>\n", file2, StandardCharsets.UTF_8);
  String output =
    ":preBuild UP-TO-DATE\n" +
    ":preF2FaDebugBuild UP-TO-DATE\n" +
    ":prepareF2FaDebugDependencies\n" +
    ":compileF2FaDebugRenderscript UP-TO-DATE\n" +
    ":mergeF2FaDebugResources FAILED\n" +
    "\n" +
    "FAILURE: Build failed with an exception.\n" +
    "\n" +
    "* What went wrong:\n" +
    "Execution failed for task ':mergeF2FaDebugResources'.\n" +
    "> Duplicate resources: " + path1 + ":string/group2_string, " + path2 + ":string/group2_string\n" +
    "\n" +
    "* Try:\n" +
    "Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.\n" +
    "\n" +
    "BUILD FAILED\n" +
    "\n" +
    "Total time: 6.462 secs";
  assertEquals("0: Simple::preBuild UP-TO-DATE\n" +
               "1: Simple::preF2FaDebugBuild UP-TO-DATE\n" +
               "2: Simple::prepareF2FaDebugDependencies\n" +
               "3: Simple::compileF2FaDebugRenderscript UP-TO-DATE\n" +
               "4: Simple::mergeF2FaDebugResources FAILED\n" +
               "5: Error:> Duplicate resources: " + path1 + ":string/group2_string, " + path2 + ":string/group2_string\n" +
               "\t" + path1 + ":4:13\n" +
               "\t" + path2 + ":3:31\n" +
               "6: Error:Execution failed for task ':mergeF2FaDebugResources'.\n" +
               "\t" + path1 + ":4:13\n" +
               "7: Info:BUILD FAILED\n" +
               "8: Info:Total time: 6.462 secs\n",
               toString(parser.parseGradleOutput(output)));
  file1.delete();
  file2.delete();
}