aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine
diff options
context:
space:
mode:
authorSteve Marion <steve.marion@sonarsource.com>2024-02-12 12:10:06 +0100
committersonartech <sonartech@sonarsource.com>2024-02-12 20:02:28 +0000
commit172288cc06ac9da7918f99ed217ddb3c0382679a (patch)
treefd5cf6ad5a0da03514a6e44a76d2ebb221bd122f /sonar-scanner-engine
parent862dc5ac73288758314237c15bfd1e84daa10d31 (diff)
downloadsonarqube-172288cc06ac9da7918f99ed217ddb3c0382679a.tar.gz
sonarqube-172288cc06ac9da7918f99ed217ddb3c0382679a.zip
NO-JIRA backport flaky test fixes done during SONAR-18408
Diffstat (limited to 'sonar-scanner-engine')
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scm/git/CompositeBlameCommandTest.java36
1 files changed, 7 insertions, 29 deletions
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scm/git/CompositeBlameCommandTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scm/git/CompositeBlameCommandTest.java
index c0874f07cd7..ad12cc1b2b9 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scm/git/CompositeBlameCommandTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scm/git/CompositeBlameCommandTest.java
@@ -30,6 +30,8 @@ import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
import org.apache.commons.io.FileUtils;
import org.junit.Rule;
import org.junit.Test;
@@ -248,8 +250,8 @@ public class CompositeBlameCommandTest {
TestBlameOutput output = new TestBlameOutput();
blameCommand.blame(input, output);
- assertThat(logTester.logs()).first()
- .matches(s -> s.contains("This git repository references another local repository which is not well supported"));
+ assertThat(logTester.logs())
+ .anyMatch(s -> s.contains("This git repository references another local repository which is not well supported"));
// contains commits referenced from the old clone and commits in the new clone
assertThat(output.blame).containsKey(inputFile);
@@ -278,33 +280,9 @@ public class CompositeBlameCommandTest {
String revision = "6b3aab35a3ea32c1636fee56f996e677653c48ea";
String author = "david@gageot.net";
verify(blameResult).blameResult(inputFile,
- Arrays.asList(
- new BlameLine().revision(revision).date(revisionDate).author(author),
- new BlameLine().revision(revision).date(revisionDate).author(author),
- new BlameLine().revision(revision).date(revisionDate).author(author),
- new BlameLine().revision(revision).date(revisionDate).author(author),
- new BlameLine().revision(revision).date(revisionDate).author(author),
- new BlameLine().revision(revision).date(revisionDate).author(author),
- new BlameLine().revision(revision).date(revisionDate).author(author),
- new BlameLine().revision(revision).date(revisionDate).author(author),
- new BlameLine().revision(revision).date(revisionDate).author(author),
- new BlameLine().revision(revision).date(revisionDate).author(author),
- new BlameLine().revision(revision).date(revisionDate).author(author),
- new BlameLine().revision(revision).date(revisionDate).author(author),
- new BlameLine().revision(revision).date(revisionDate).author(author),
- new BlameLine().revision(revision).date(revisionDate).author(author),
- new BlameLine().revision(revision).date(revisionDate).author(author),
- new BlameLine().revision(revision).date(revisionDate).author(author),
- new BlameLine().revision(revision).date(revisionDate).author(author),
- new BlameLine().revision(revision).date(revisionDate).author(author),
- new BlameLine().revision(revision).date(revisionDate).author(author),
- new BlameLine().revision(revision).date(revisionDate).author(author),
- new BlameLine().revision(revision).date(revisionDate).author(author),
- new BlameLine().revision(revision).date(revisionDate).author(author),
- new BlameLine().revision(revision).date(revisionDate).author(author),
- new BlameLine().revision(revision).date(revisionDate).author(author),
- new BlameLine().revision(revision).date(revisionDate).author(author),
- new BlameLine().revision(revision).date(revisionDate).author(author)));
+ Stream.generate(() -> new BlameLine().revision(revision).date(revisionDate).author(author))
+ .limit(26)
+ .collect(Collectors.toList()));
}
private BlameCommand.BlameInput setUpBlameInputWithFile(Path baseDir) {