@Test
  public void shouldNotShowIgnoredFiles() throws Exception {
    // given
    resetRepositoryToCreateInitialTag();
    String ignoredName = "to-be-ignored.txt";

    IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJ1);

    IFile ignoredFile = proj.getFile(ignoredName);
    ignoredFile.create(
        new ByteArrayInputStream("content of ignored file".getBytes(proj.getDefaultCharset())),
        false,
        null);

    IFile gitignore = proj.getFile(".gitignore");
    gitignore.create(
        new ByteArrayInputStream(ignoredName.getBytes(proj.getDefaultCharset())), false, null);
    proj.refreshLocal(IResource.DEPTH_INFINITE, null);

    // when
    launchSynchronization(INITIAL_TAG, HEAD, true);

    // then
    SWTBotTree syncViewTree = bot.viewByTitle("Synchronize").bot().tree();
    SWTBotTreeItem projectTree = waitForNodeWithText(syncViewTree, PROJ1);
    projectTree.expand();
    assertEquals(1, projectTree.getItems().length);
  }
  private void configure(
      final IProject project,
      Collection<IFile> filesToAnalyze,
      final Properties properties,
      final IProgressMonitor monitor) {
    String projectName = project.getName();
    String encoding;
    try {
      encoding = project.getDefaultCharset();
    } catch (CoreException e) {
      throw new SonarEclipseException("Unable to get charset from project", e);
    }

    properties.setProperty(SonarLintProperties.PROJECT_NAME_PROPERTY, projectName);
    properties.setProperty(SonarLintProperties.PROJECT_VERSION_PROPERTY, "0.1-SNAPSHOT");
    properties.setProperty(SonarLintProperties.ENCODING_PROPERTY, encoding);

    ProjectConfigurationRequest configuratorRequest =
        new ProjectConfigurationRequest(project, filesToAnalyze, properties);
    Collection<ProjectConfigurator> configurators = ConfiguratorUtils.getConfigurators();
    for (ProjectConfigurator configurator : configurators) {
      if (configurator.canConfigure(project)) {
        configurator.configure(configuratorRequest, monitor);
        usedConfigurators.add(configurator);
      }
    }

    ProjectConfigurator.appendProperty(
        properties,
        SonarConfiguratorProperties.TEST_INCLUSIONS_PROPERTY,
        PreferencesUtils.getTestFileRegexps());
    if (!properties.containsKey(SonarConfiguratorProperties.SOURCE_DIRS_PROPERTY)
        && !properties.containsKey(SonarConfiguratorProperties.TEST_DIRS_PROPERTY)) {
      // Try to analyze all files
      properties.setProperty(SonarConfiguratorProperties.SOURCE_DIRS_PROPERTY, ".");
      properties.setProperty(SonarConfiguratorProperties.TEST_DIRS_PROPERTY, ".");
      // Try to exclude derived folders
      try {
        for (IResource member : project.members()) {
          if (member.isDerived()) {
            ProjectConfigurator.appendProperty(
                properties,
                SonarConfiguratorProperties.SOURCE_EXCLUSIONS_PROPERTY,
                member.getName() + "/**/*");
            ProjectConfigurator.appendProperty(
                properties,
                SonarConfiguratorProperties.TEST_EXCLUSIONS_PROPERTY,
                member.getName() + "/**/*");
          }
        }
      } catch (CoreException e) {
        throw new IllegalStateException("Unable to list members of " + project, e);
      }
    }
  }
  @Test
  public void shouldRefreshSyncResultAfterWorkspaceChange() throws Exception {
    // given
    String newFileName = "new.txt";
    resetRepositoryToCreateInitialTag();
    launchSynchronization(INITIAL_TAG, HEAD, true);
    IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJ1);

    // when
    IFile newFile = proj.getFile(newFileName);
    newFile.create(
        new ByteArrayInputStream("content of new file".getBytes(proj.getDefaultCharset())),
        false,
        null);
    Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);

    // then
    SWTBotTree syncViewTree = bot.viewByTitle("Synchronize").bot().tree();
    SWTBotTreeItem[] syncItems = syncViewTree.getAllItems();
    assertTrue(syncItems[0].getText().contains(PROJ1));
    syncItems[0].expand();
    // WidgetNotFoundException will be thrown when node named 'new.txt' not exists
    assertNotNull(syncItems[0].getNode(newFileName));
  }