SimpleCompilationTest.java revision 731b74f7f44e67312a1fc4161c4e0aae221b2417
19064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar/*
29064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar * Copyright (C) 2015 The Android Open Source Project
39064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar *
49064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar * Licensed under the Apache License, Version 2.0 (the "License");
59064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar * you may not use this file except in compliance with the License.
69064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar * You may obtain a copy of the License at
79064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar *
89064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar *      http://www.apache.org/licenses/LICENSE-2.0
99064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar *
109064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar * Unless required by applicable law or agreed to in writing, software
119064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar * distributed under the License is distributed on an "AS IS" BASIS,
129064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
139064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar * See the License for the specific language governing permissions and
149064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar * limitations under the License.
159064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar */
169064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar
179064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyarpackage android.databinding.compilationTest;
189064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar
199064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar
209064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyarimport org.apache.commons.lang3.StringUtils;
219064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyarimport org.junit.Test;
229064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar
23731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyarimport android.databinding.tool.processing.ErrorMessages;
24731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyarimport android.databinding.tool.processing.ScopedErrorReport;
25731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyarimport android.databinding.tool.processing.ScopedException;
26731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyarimport android.databinding.tool.store.Location;
27731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar
288b1da958f181639d33dfaa907c0ee66add2decd6Yigit Boyarimport java.io.File;
299064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyarimport java.io.IOException;
309064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyarimport java.net.URISyntaxException;
31731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyarimport java.util.List;
329064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar
339064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyarimport static org.junit.Assert.assertEquals;
349064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyarimport static org.junit.Assert.assertNotEquals;
35731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyarimport static org.junit.Assert.assertNotNull;
369064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyarimport static org.junit.Assert.assertTrue;
37731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyarimport static org.junit.Assert.fail;
389064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar
399064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyarpublic class SimpleCompilationTest extends BaseCompilationTest {
409064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar
419064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar    @Test
429064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar    public void listTasks() throws IOException, URISyntaxException, InterruptedException {
439064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar        prepareProject();
449064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar        CompilationResult result = runGradle("tasks");
459064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar        assertEquals(0, result.resultCode);
469064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar        assertTrue("there should not be any errors", StringUtils.isEmpty(result.error));
479064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar        assertTrue("Test sanity, empty project tasks",
489064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar                result.resultContainsText("All tasks runnable from root project"));
499064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar    }
509064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar
519064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar    @Test
529064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar    public void testEmptyCompilation() throws IOException, URISyntaxException, InterruptedException {
539064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar        prepareProject();
549064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar        CompilationResult result = runGradle("assembleDebug");
559064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar        assertEquals(0, result.resultCode);
569064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar        assertTrue("there should not be any errors " + result.error, StringUtils.isEmpty(result.error));
579064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar        assertTrue("Test sanity, should compile fine",
589064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar                result.resultContainsText("BUILD SUCCESSFUL"));
599064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar    }
609064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar
61731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar    private ScopedException singleFileErrorTest(String resource, String targetFile,
62731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar            String expectedExtract, String errorMessage)
63731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar            throws IOException, URISyntaxException, InterruptedException {
64731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        prepareProject();
65731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        copyResourceTo(resource, targetFile);
66731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        CompilationResult result = runGradle("assembleDebug");
67731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        assertNotEquals(0, result.resultCode);
68731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        ScopedException scopedException = result.getBindingException();
69731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        assertNotNull(scopedException);
70731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        ScopedErrorReport report = scopedException.getScopedErrorReport();
71731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        assertNotNull(report);
72731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        assertEquals(1, report.getLocations().size());
73731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        Location loc = report.getLocations().get(0);
74731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        if (expectedExtract != null) {
75731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar            String extract = extract(targetFile, loc);
76731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar            assertEquals(expectedExtract, extract);
77731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        }
78731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        final File errorFile = new File(report.getFilePath());
79731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        assertTrue(errorFile.exists());
80731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        assertEquals(new File(testFolder, targetFile).getCanonicalFile(),
81731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar                errorFile.getCanonicalFile());
82731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        if (errorMessage != null) {
83731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar            assertEquals(errorMessage, scopedException.getBareMessage());
84731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        }
85731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        return scopedException;
86731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar    }
87731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar
889064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar    @Test
89731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar    public void testMultipleExceptionsInDifferentFiles()
90731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar            throws IOException, URISyntaxException, InterruptedException {
919064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar        prepareProject();
923e3bf43a2e11fb433b43558e2e05255edfa5b6a8George Mount        copyResourceTo("/layout/undefined_variable_binding.xml",
933e3bf43a2e11fb433b43558e2e05255edfa5b6a8George Mount                "/app/src/main/res/layout/broken.xml");
94731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        copyResourceTo("/layout/invalid_setter_binding.xml",
95731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar                "/app/src/main/res/layout/invalid_setter.xml");
969064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar        CompilationResult result = runGradle("assembleDebug");
979064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar        assertNotEquals(0, result.resultCode);
98731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        List<ScopedException> bindingExceptions = result.getBindingExceptions();
99731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        assertEquals(2, bindingExceptions.size());
100731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        File broken = new File(testFolder, "/app/src/main/res/layout/broken.xml");
101731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        File invalidSetter = new File(testFolder, "/app/src/main/res/layout/invalid_setter.xml");
102731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        for (ScopedException exception : bindingExceptions) {
103731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar            ScopedErrorReport report = exception.getScopedErrorReport();
104731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar            final File errorFile = new File(report.getFilePath());
105731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar            String message = null;
106731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar            String expectedErrorFile = null;
107731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar            if (errorFile.getCanonicalPath().equals(broken.getCanonicalPath())) {
108731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar                message = String.format(ErrorMessages.UNDEFINED_VARIABLE, "myVariable");
109731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar                expectedErrorFile = "/app/src/main/res/layout/broken.xml";
110731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar            } else if (errorFile.getCanonicalPath().equals(invalidSetter.getCanonicalPath())) {
111731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar                message = String.format(ErrorMessages.CANNOT_FIND_SETTER_CALL, "android:textx",
112731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar                        String.class.getCanonicalName());
113731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar                expectedErrorFile = "/app/src/main/res/layout/invalid_setter.xml";
114731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar            } else {
115731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar                fail("unexpected exception " + exception.getBareMessage());
116731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar            }
117731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar            assertEquals(1, report.getLocations().size());
118731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar            Location loc = report.getLocations().get(0);
119731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar            String extract = extract(expectedErrorFile, loc);
120731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar            assertEquals("myVariable", extract);
121731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar            assertEquals(message, exception.getBareMessage());
122731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        }
123731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar    }
124731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar
125731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar    @Test
126731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar    public void testUndefinedVariable() throws IOException, URISyntaxException,
127731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar            InterruptedException {
128731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        ScopedException ex = singleFileErrorTest("/layout/undefined_variable_binding.xml",
129731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar                "/app/src/main/res/layout/broken.xml", "myVariable",
130731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar                String.format(ErrorMessages.UNDEFINED_VARIABLE, "myVariable"));
131731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar    }
132731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar
133731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar    @Test
134731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar    public void testInvalidSetterBinding() throws IOException, URISyntaxException,
135731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar            InterruptedException {
136731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        prepareProject();
137731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        ScopedException ex = singleFileErrorTest("/layout/invalid_setter_binding.xml",
138731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar                "/app/src/main/res/layout/invalid_setter.xml", "myVariable",
139731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar                String.format(ErrorMessages.CANNOT_FIND_SETTER_CALL, "android:textx",
140731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar                        String.class.getCanonicalName()));
141731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar    }
142731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar
143731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar    @Test
144731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar    public void testInvalidVariableType() throws IOException, URISyntaxException,
145731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar            InterruptedException {
146731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        prepareProject();
147731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        ScopedException ex = singleFileErrorTest("/layout/invalid_variable_type.xml",
148731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar                "/app/src/main/res/layout/invalid_variable.xml", "myVariable",
149731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar                String.format(ErrorMessages.CANNOT_RESOLVE_TYPE, "myVariable~"));
1509064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar    }
1518b1da958f181639d33dfaa907c0ee66add2decd6Yigit Boyar
1528b1da958f181639d33dfaa907c0ee66add2decd6Yigit Boyar    @Test
1538b1da958f181639d33dfaa907c0ee66add2decd6Yigit Boyar    public void testSingleModule() throws IOException, URISyntaxException, InterruptedException {
1548b1da958f181639d33dfaa907c0ee66add2decd6Yigit Boyar        prepareApp(toMap(KEY_DEPENDENCIES, "compile project(':module1')",
1558b1da958f181639d33dfaa907c0ee66add2decd6Yigit Boyar                KEY_SETTINGS_INCLUDES, "include ':app'\ninclude ':module1'"));
1568b1da958f181639d33dfaa907c0ee66add2decd6Yigit Boyar        prepareModule("module1", "com.example.module1", toMap());
1578b1da958f181639d33dfaa907c0ee66add2decd6Yigit Boyar        copyResourceTo("/layout/basic_layout.xml", "/module1/src/main/res/layout/module_layout.xml");
1588b1da958f181639d33dfaa907c0ee66add2decd6Yigit Boyar        copyResourceTo("/layout/basic_layout.xml", "/app/src/main/res/layout/app_layout.xml");
1598b1da958f181639d33dfaa907c0ee66add2decd6Yigit Boyar        CompilationResult result = runGradle("assembleDebug");
1608b1da958f181639d33dfaa907c0ee66add2decd6Yigit Boyar        assertEquals(result.error, 0, result.resultCode);
1618b1da958f181639d33dfaa907c0ee66add2decd6Yigit Boyar    }
1628b1da958f181639d33dfaa907c0ee66add2decd6Yigit Boyar
1638b1da958f181639d33dfaa907c0ee66add2decd6Yigit Boyar    @Test
1648b1da958f181639d33dfaa907c0ee66add2decd6Yigit Boyar    public void testTwoLevelDependency() throws IOException, URISyntaxException, InterruptedException {
1658b1da958f181639d33dfaa907c0ee66add2decd6Yigit Boyar        prepareApp(toMap(KEY_DEPENDENCIES, "compile project(':module1')",
1668b1da958f181639d33dfaa907c0ee66add2decd6Yigit Boyar                KEY_SETTINGS_INCLUDES, "include ':app'\ninclude ':module1'\n"
1678b1da958f181639d33dfaa907c0ee66add2decd6Yigit Boyar                        + "include ':module2'"));
1688b1da958f181639d33dfaa907c0ee66add2decd6Yigit Boyar        prepareModule("module1", "com.example.module1", toMap(KEY_DEPENDENCIES,
1698b1da958f181639d33dfaa907c0ee66add2decd6Yigit Boyar                "compile project(':module2')"));
1708b1da958f181639d33dfaa907c0ee66add2decd6Yigit Boyar        prepareModule("module2", "com.example.module2", toMap());
1713e3bf43a2e11fb433b43558e2e05255edfa5b6a8George Mount        copyResourceTo("/layout/basic_layout.xml",
1723e3bf43a2e11fb433b43558e2e05255edfa5b6a8George Mount                "/module2/src/main/res/layout/module2_layout.xml");
1738b1da958f181639d33dfaa907c0ee66add2decd6Yigit Boyar        copyResourceTo("/layout/basic_layout.xml", "/module1/src/main/res/layout/module1_layout.xml");
1748b1da958f181639d33dfaa907c0ee66add2decd6Yigit Boyar        copyResourceTo("/layout/basic_layout.xml", "/app/src/main/res/layout/app_layout.xml");
1758b1da958f181639d33dfaa907c0ee66add2decd6Yigit Boyar        CompilationResult result = runGradle("assembleDebug");
1768b1da958f181639d33dfaa907c0ee66add2decd6Yigit Boyar        assertEquals(result.error, 0, result.resultCode);
1778b1da958f181639d33dfaa907c0ee66add2decd6Yigit Boyar    }
1783e3bf43a2e11fb433b43558e2e05255edfa5b6a8George Mount
1793e3bf43a2e11fb433b43558e2e05255edfa5b6a8George Mount    @Test
1803e3bf43a2e11fb433b43558e2e05255edfa5b6a8George Mount    public void testIncludeInMerge() throws Throwable {
1813e3bf43a2e11fb433b43558e2e05255edfa5b6a8George Mount        prepareProject();
1823e3bf43a2e11fb433b43558e2e05255edfa5b6a8George Mount        copyResourceTo("/layout/merge_include.xml", "/app/src/main/res/layout/merge_include.xml");
1833e3bf43a2e11fb433b43558e2e05255edfa5b6a8George Mount        CompilationResult result = runGradle("assembleDebug");
1843e3bf43a2e11fb433b43558e2e05255edfa5b6a8George Mount        assertNotEquals(0, result.resultCode);
185731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        List<ScopedException> errors = ScopedException.extractErrors(result.error);
186731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        assertEquals(result.error, 1, errors.size());
187731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        final ScopedException ex = errors.get(0);
188731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        final ScopedErrorReport report = ex.getScopedErrorReport();
189731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        final File errorFile = new File(report.getFilePath());
190731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        assertTrue(errorFile.exists());
191731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        assertEquals(
192731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar                new File(testFolder, "/app/src/main/res/layout/merge_include.xml")
193731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar                        .getCanonicalFile(),
194731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar                errorFile.getCanonicalFile());
195731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar        assertEquals("Merge shouldn't support includes as root. Error message was '" + result.error,
196731b74f7f44e67312a1fc4161c4e0aae221b2417Yigit Boyar                ErrorMessages.INCLUDE_INSIDE_MERGE, ex.getBareMessage());
1973e3bf43a2e11fb433b43558e2e05255edfa5b6a8George Mount    }
1989064a1dd60eb8c2f9d2ed705b36bb5f0b1629771Yigit Boyar}
199