@Test
public void redirectFileLinksOutput() throws Exception {

  // Do not run tests on Windows (see http://b.android.com/222904)
  assumeFalse(SystemInfo.isWindows);
  // Need file to be named (exactly) values.xml
  File tempDir = Files.createTempDir();
  File layoutDir = new File(tempDir, "layout-land");
  layoutDir.mkdirs();
  sourceFile = new File(layoutDir, "main.xml");
  sourceFilePath = sourceFile.getAbsolutePath();
  writeToFile(
    "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
    "<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" +
    "    android:orientation=\"vertical\"\n" +
    "    android:layout_width=\"fill_parent\"\n" +
    "    android:layout_height=\"fill_parent\"\n" +
    "    >\n" +
    "<TextView\n" +
    "    android:layout_width=\"fill_parent\"\n" +
    "    android:layout_height=\"wrap_content\"\n" +
    "    android:text=\"Test App - Basic\"\n" +
    "    android:id=\"@+id/text\"\n" +
    "    />\n" +
    "</LinearLayout>\n" +
    "\n" +
    "<!-- From: file:src/test/resources/testData/resources/incMergeData/filesVsValues/main/layout/main.xml -->");
  String messageText = "Random error message here";
  String err = sourceFilePath + ":4: error: Error: " + messageText;
  Collection<Message> messages = parser.parseGradleOutput(err);
  assertEquals(1, messages.size());
  assertEquals("[message count]", 1, messages.size());
  Message message = ContainerUtil.getFirstItem(messages);
  assertNotNull(message);
  // NOT sourceFilePath; should be translated back from source comment
  String expected = "src/test/resources/testData/resources/incMergeData/filesVsValues/main/layout/main.xml";
  assertEquals("[file path]", expected, getSystemIndependentSourcePath(message));
  assertEquals("[message severity]", Message.Kind.ERROR, message.getKind());
  assertEquals("[message text]", messageText, message.getText());
  assertEquals("[position line]", 4, message.getLineNumber());
  //assertEquals("[position column]", 35, message.getColumn());
  // TODO: Test encoding issues (e.g. & in path where the XML source comment would be &amp; instead)
}