]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-11077 fix DEBUG log in FileMoveDetectionStep
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Sun, 5 Aug 2018 21:18:56 +0000 (23:18 +0200)
committerSonarTech <sonartech@sonarsource.com>
Tue, 7 Aug 2018 18:21:21 +0000 (20:21 +0200)
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/filemove/FileMoveDetectionStep.java
server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/filemove/FileMoveDetectionStepTest.java

index 78d703cab95beb40f72d0619126b2d90aef76ec3..56a519030754ec520da51a9ee0ff9bce8f21d033 100644 (file)
@@ -138,7 +138,7 @@ public class FileMoveDetectionStep implements ComputationStep {
 
     // not a single match with score higher than MIN_REQUIRED_SCORE => abort
     if (scoreMatrix.getMaxScore() < MIN_REQUIRED_SCORE) {
-      LOG.debug("max score in matrix is less than min required score (%s). Do nothing.", MIN_REQUIRED_SCORE);
+      LOG.debug("max score in matrix is less than min required score ({}). Do nothing.", MIN_REQUIRED_SCORE);
       return;
     }
 
index 15dd2b9992efda01ff966384f8c83e620548ac69..44d1f55c37a9fa77f37c5dfda95321398b93756a 100644 (file)
@@ -33,6 +33,8 @@ import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.sonar.api.utils.System2;
+import org.sonar.api.utils.log.LogTester;
+import org.sonar.api.utils.log.LoggerLevel;
 import org.sonar.ce.task.projectanalysis.analysis.Analysis;
 import org.sonar.ce.task.projectanalysis.analysis.AnalysisMetadataHolderRule;
 import org.sonar.ce.task.projectanalysis.component.Component;
@@ -217,6 +219,8 @@ public class FileMoveDetectionStepTest {
   public MutableMovedFilesRepositoryRule movedFilesRepository = new MutableMovedFilesRepositoryRule();
   @Rule
   public DbTester dbTester = DbTester.create(System2.INSTANCE);
+  @Rule
+  public LogTester logTester = new LogTester();
 
   private DbClient dbClient = dbTester.getDbClient();
   private ComponentDto project;
@@ -390,6 +394,7 @@ public class FileMoveDetectionStepTest {
     assertThat(movedFilesRepository.getComponentsWithOriginal()).isEmpty();
     assertThat(scoreMatrixDumper.scoreMatrix.getMaxScore()).isZero();
     verifyStatistics(context, 1, 1);
+    assertThat(logTester.logs(LoggerLevel.DEBUG)).contains("max score in matrix is less than min required score (85). Do nothing.");
   }
 
   @Test