Search in sources :

Example 11 with SyncMessagesStub

use of com.android.tools.idea.gradle.project.sync.messages.SyncMessagesStub in project android by JetBrains.

the class EncodingValidationStrategyTest method testFixAndReportFoundIssuesWithNoMismatch.

public void testFixAndReportFoundIssuesWithNoMismatch() {
    SyncMessagesStub syncMessages = SyncMessagesStub.replaceSyncMessagesService(getProject());
    myStrategy.setMismatchingEncoding(null);
    myStrategy.fixAndReportFoundIssues();
    SyncMessage message = syncMessages.getFirstReportedMessage();
    assertNull(message);
    verify(myEncodings, never()).setDefaultCharsetName(anyString());
}
Also used : SyncMessage(com.android.tools.idea.gradle.project.sync.messages.SyncMessage) SyncMessagesStub(com.android.tools.idea.gradle.project.sync.messages.SyncMessagesStub)

Example 12 with SyncMessagesStub

use of com.android.tools.idea.gradle.project.sync.messages.SyncMessagesStub in project android by JetBrains.

the class UniquePathModuleValidatorStrategyTest method testFixAndReportFoundIssues.

public void testFixAndReportFoundIssues() throws Exception {
    Project project = getProject();
    SyncMessagesStub syncMessages = SyncMessagesStub.replaceSyncMessagesService(project);
    ProjectSubset projectSubset = IdeComponents.replaceServiceWithMock(project, ProjectSubset.class);
    when(projectSubset.isFeatureEnabled()).thenReturn(false);
    Multimap<String, Module> modulesByPath = myStrategy.getModulesByPath();
    modulesByPath.putAll("path", Lists.newArrayList(myModule1, myModule2));
    when(myModule1.getName()).thenReturn("module1");
    when(myModule2.getName()).thenReturn("module2");
    myStrategy.fixAndReportFoundIssues();
    SyncMessage message = syncMessages.getFirstReportedMessage();
    assertNotNull(message);
    assertAbout(syncMessage()).that(message).hasMessageLine("The modules ['module1', 'module2'] point to same directory in the file system.", 0);
}
Also used : SyncMessage(com.android.tools.idea.gradle.project.sync.messages.SyncMessage) Project(com.intellij.openapi.project.Project) SyncMessagesStub(com.android.tools.idea.gradle.project.sync.messages.SyncMessagesStub) ProjectSubset(com.android.tools.idea.gradle.project.subset.ProjectSubset) Module(com.intellij.openapi.module.Module)

Aggregations

SyncMessage (com.android.tools.idea.gradle.project.sync.messages.SyncMessage)12 SyncMessagesStub (com.android.tools.idea.gradle.project.sync.messages.SyncMessagesStub)12 Project (com.intellij.openapi.project.Project)5 Module (com.intellij.openapi.module.Module)3 AndroidProject (com.android.builder.model.AndroidProject)2 ProjectSubset (com.android.tools.idea.gradle.project.subset.ProjectSubset)2 File (java.io.File)2 GradleBuildModel (com.android.tools.idea.gradle.dsl.model.GradleBuildModel)1 ArtifactDependencyModel (com.android.tools.idea.gradle.dsl.model.dependencies.ArtifactDependencyModel)1 AndroidModuleModel (com.android.tools.idea.gradle.project.model.AndroidModuleModel)1 GradleSyncSummary (com.android.tools.idea.gradle.project.sync.GradleSyncSummary)1 GradleUtil.getAndroidProject (com.android.tools.idea.gradle.util.GradleUtil.getAndroidProject)1 Sdk (com.intellij.openapi.projectRoots.Sdk)1 VfsUtil.findFileByIoFile (com.intellij.openapi.vfs.VfsUtil.findFileByIoFile)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1