Package org.sonar.api.scan.filesystem

Examples of org.sonar.api.scan.filesystem.ModuleFileSystem.files()


    when(fs.testDirs()).thenReturn(testDirs);

    List<File> mainSourceFiles = scanForSourceFiles(sourceDirs);
    List<File> testSourceFiles = scanForSourceFiles(testDirs);

    when(fs.files(any(FileQuery.class))).thenReturn(mainSourceFiles);

    return fs;
  }

  public static ModuleFileSystem mockFileSystem() {
View Full Code Here


    project = new Project("key");

    JavaScriptSquidSensor sensor = new JavaScriptSquidSensor(mock(RulesProfile.class), fileLinesContextFactory, mock(ResourcePerspectives.class), fs, new NoSonarFilter());

    // no JS files -> do not execute
    when(fs.files(any(FileQuery.class))).thenReturn(Collections.<File>emptyList());
    assertThat(sensor.shouldExecuteOnProject(project)).isFalse();

    // at least one JS file -> do execute
    when(fs.files(any(FileQuery.class))).thenReturn(Arrays.asList(mock(File.class)));
    assertThat(sensor.shouldExecuteOnProject(project)).isTrue();
View Full Code Here

    // no JS files -> do not execute
    when(fs.files(any(FileQuery.class))).thenReturn(Collections.<File>emptyList());
    assertThat(sensor.shouldExecuteOnProject(project)).isFalse();

    // at least one JS file -> do execute
    when(fs.files(any(FileQuery.class))).thenReturn(Arrays.asList(mock(File.class)));
    assertThat(sensor.shouldExecuteOnProject(project)).isTrue();
  }

  @Test
  public void should_analyse() {
View Full Code Here

  @Test
  public void should_analyse() {
    ModuleFileSystem fs = mock(ModuleFileSystem.class);
    when(fs.sourceCharset()).thenReturn(Charset.forName("UTF-8"));
    ImmutableList<File> files = ImmutableList.of(new File("src/test/resources/cpd/Person.js"));
    when(fs.files(any(FileQuery.class))).thenReturn(files);


    SensorContext context = mock(SensorContext.class);
    JavaScriptSquidSensor sensor = new JavaScriptSquidSensor(mock(RulesProfile.class), fileLinesContextFactory, mock(ResourcePerspectives.class), fs, new NoSonarFilter());
View Full Code Here

    };
  }

  private ModuleFileSystem mockFileSystem() {
    ModuleFileSystem fs = mock(ModuleFileSystem.class);
    when(fs.files(any(FileQuery.class))).thenReturn(ImmutableList.of(new File("mock")));

    return fs;
  }

  private JsTestSensor mock_sensor_for_SQ_over_4_0() {
View Full Code Here

    return fs;
  }

  private JsTestSensor mock_sensor_for_SQ_over_4_0() {
    ModuleFileSystem fs = mock(ModuleFileSystem.class);
    when(fs.files(any(FileQuery.class))).thenReturn(ImmutableList.of(new File("mock")));

    return new JsTestSensor(fs, settings);
  }

}
View Full Code Here

    };
  }

  private JsTestDriverSensor mock_sensor_for_SQ_over_4_0() {
    ModuleFileSystem fs = mock(ModuleFileSystem.class);
    when(fs.files(any(FileQuery.class))).thenReturn(ImmutableList.of(new File("mock")));

    return new JsTestDriverSensor(fs, settings);
  }

}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.