use of org.sonar.api.config.internal.Encryption in project sonarqube by SonarSource.
the class GenericTestExecutionSensorTest method logWhenDeprecatedPropsAreUsed.
@Test
public void logWhenDeprecatedPropsAreUsed() throws IOException {
File basedir = temp.newFolder();
File report = new File(basedir, "report.xml");
FileUtils.write(report, "<unitTest version=\"1\"><file path=\"A.java\"><testCase name=\"test1\" duration=\"500\"/></file></unitTest>", StandardCharsets.UTF_8);
SensorContextTester context = SensorContextTester.create(basedir);
Map<String, String> settings = new HashMap<>();
settings.put(GenericTestExecutionSensor.OLD_UNIT_TEST_REPORT_PATHS_PROPERTY_KEY, "report.xml");
PropertyDefinitions defs = new PropertyDefinitions(System2.INSTANCE, GenericTestExecutionSensor.properties());
DefaultConfiguration config = new ProjectConfiguration(defs, new Encryption(null), settings);
new GenericTestExecutionSensor(mock(TestPlanBuilder.class), config).execute(context);
assertThat(logTester.logs(LoggerLevel.WARN)).contains("Using 'unitTest' as root element of the report is deprecated. Please change to 'testExecutions'.", "Property 'sonar.genericcoverage.unitTestReportPaths' is deprecated. Please use 'sonar.testExecutionReportPaths' instead.");
assertThat(logTester.logs(LoggerLevel.INFO)).contains("Imported test execution data for 0 files", "Test execution data ignored for 1 unknown files, including:\nA.java");
}
Aggregations