@Test
public void mismatchedTag() throws Exception {

  // https://code.google.com/p/android/issues/detail?id=59824
  createTempXmlFile();
  String output =
    ":AudioPlayer:prepareDebugDependencies\n" +
    ":AudioPlayer:compileDebugAidl UP-TO-DATE\n" +
    ":AudioPlayer:generateDebugBuildConfig UP-TO-DATE\n" +
    ":AudioPlayer:mergeDebugAssets UP-TO-DATE\n" +
    ":AudioPlayer:compileDebugRenderscript UP-TO-DATE\n" +
    ":AudioPlayer:mergeDebugResources UP-TO-DATE\n" +
    ":AudioPlayer:processDebugManifest UP-TO-DATE\n" +
    ":AudioPlayer:processDebugResources\n" +
    sourceFilePath + ":101: error: Error parsing XML: mismatched tag\n" +
    ":AudioPlayer:processDebugResources FAILED\n" +
    "\n" +
    "FAILURE: Build failed with an exception.\n" +
    "\n" +
    "* What went wrong:\n" +
    "Execution failed for task ':AudioPlayer:processDebugResources'.\n" +
    "> Failed to run command:\n" +
    "  \t/Users/sbarta/sdk/build-tools/android-4.2.2/aapt package -f --no-crunch -I ...\n" +
    "  Error Code:\n" +
    "  \t1\n" +
    "  Output:\n" +
    "  \t" + sourceFilePath + ":101: error: Error parsing XML: mismatched tag\n" +
    "\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: 3.836 secs";
  assertEquals("0: Simple::AudioPlayer:prepareDebugDependencies\n" +
               "1: Simple::AudioPlayer:compileDebugAidl UP-TO-DATE\n" +
               "2: Simple::AudioPlayer:generateDebugBuildConfig UP-TO-DATE\n" +
               "3: Simple::AudioPlayer:mergeDebugAssets UP-TO-DATE\n" +
               "4: Simple::AudioPlayer:compileDebugRenderscript UP-TO-DATE\n" +
               "5: Simple::AudioPlayer:mergeDebugResources UP-TO-DATE\n" +
               "6: Simple::AudioPlayer:processDebugManifest UP-TO-DATE\n" +
               "7: Simple::AudioPlayer:processDebugResources\n" +
               "8: Error:Error parsing XML: mismatched tag\n" +
               "\t" + sourceFilePath + ":101:-1\n" +
               "9: Simple::AudioPlayer:processDebugResources FAILED\n" +
               "10: Error:Error while executing aapt command\n" +
               "11: Error:Execution failed for task ':AudioPlayer:processDebugResources'.\n" +
               "12: Info:BUILD FAILED\n" +
               "13: Info:Total time: 3.836 secs\n",
               toString(parser.parseGradleOutput(output)));
  sourceFile.delete();
}