use of com.android.tools.idea.gradle.run.MakeBeforeRunTaskProvider in project android by JetBrains.
the class PostSyncProjectSetupTest method testJUnitRunConfigurationSetup.
public void testJUnitRunConfigurationSetup() {
when(myIdeInfo.isAndroidStudio()).thenReturn(true);
PostSyncProjectSetup.Request request = new PostSyncProjectSetup.Request();
mySetup.setUpProject(request, myProgressIndicator);
ConfigurationFactory configurationFactory = AndroidJUnitConfigurationType.getInstance().getConfigurationFactories()[0];
AndroidJUnitConfiguration jUnitConfiguration = new AndroidJUnitConfiguration("", getProject(), configurationFactory);
myRunManager.addConfiguration(myRunManager.createConfiguration(jUnitConfiguration, configurationFactory), true);
List<RunConfiguration> junitRunConfigurations = myRunManager.getConfigurationsList(AndroidJUnitConfigurationType.getInstance());
for (RunConfiguration runConfiguration : junitRunConfigurations) {
assertSize(1, myRunManager.getBeforeRunTasks(runConfiguration));
assertEquals(MakeBeforeRunTaskProvider.ID, myRunManager.getBeforeRunTasks(runConfiguration).get(0).getProviderId());
}
RunConfiguration runConfiguration = junitRunConfigurations.get(0);
List<BeforeRunTask> tasks = new LinkedList<>(myRunManager.getBeforeRunTasks(runConfiguration));
BeforeRunTask newTask = new MakeBeforeRunTaskProvider(getProject()).createTask(runConfiguration);
newTask.setEnabled(true);
tasks.add(newTask);
myRunManager.setBeforeRunTasks(runConfiguration, tasks, false);
mySetup.setUpProject(request, myProgressIndicator);
assertSize(2, myRunManager.getBeforeRunTasks(runConfiguration));
}
Aggregations