aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api-impl
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2023-01-12 09:35:20 +0100
committersonartech <sonartech@sonarsource.com>2023-01-12 20:02:51 +0000
commit118a3ed166799831e097748f2ce8e113298ad14e (patch)
tree9ea5410359990f4ef457bf0822b5b31a770d15de /sonar-plugin-api-impl
parent0b5343ff7744ec27ed14a90e07833319719bc9a8 (diff)
downloadsonarqube-118a3ed166799831e097748f2ce8e113298ad14e.tar.gz
sonarqube-118a3ed166799831e097748f2ce8e113298ad14e.zip
[NO JIRA] Fix quality issues related to assertions
Diffstat (limited to 'sonar-plugin-api-impl')
-rw-r--r--sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/FileMetadataTest.java5
-rw-r--r--sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/PathPatternTest.java10
2 files changed, 8 insertions, 7 deletions
diff --git a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/FileMetadataTest.java b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/FileMetadataTest.java
index 10aaea74e34..bd964a8f15d 100644
--- a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/FileMetadataTest.java
+++ b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/FileMetadataTest.java
@@ -291,8 +291,9 @@ public class FileMetadataTest {
String hash1a = new FileMetadata(analysisWarnings).readMetadata(new FileInputStream(file1a), StandardCharsets.UTF_8, file1a.getName()).hash();
String hash2 = new FileMetadata(analysisWarnings).readMetadata(new FileInputStream(file2), StandardCharsets.UTF_8, file2.getName()).hash();
- assertThat(hash1).isEqualTo(hash1a);
- assertThat(hash1).isNotEqualTo(hash2);
+ assertThat(hash1)
+ .isEqualTo(hash1a)
+ .isNotEqualTo(hash2);
}
@Test
diff --git a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/PathPatternTest.java b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/PathPatternTest.java
index c4e06e5651e..9b68c59d270 100644
--- a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/PathPatternTest.java
+++ b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/PathPatternTest.java
@@ -45,7 +45,7 @@ public class PathPatternTest {
@Test
public void match_relative_path() {
PathPattern pattern = PathPattern.create("**/*Foo.java");
- assertThat(pattern.toString()).isEqualTo("**/*Foo.java");
+ assertThat(pattern).hasToString("**/*Foo.java");
IndexedFile indexedFile = new DefaultIndexedFile("ABCDE", baseDir, "src/main/java/org/MyFoo.java", null);
assertThat(pattern.match(indexedFile.path(), Paths.get(indexedFile.relativePath()))).isTrue();
@@ -72,7 +72,7 @@ public class PathPatternTest {
@Test
public void match_absolute_path() {
PathPattern pattern = PathPattern.create("file:**/src/main/**Foo.java");
- assertThat(pattern.toString()).isEqualTo("file:**/src/main/**Foo.java");
+ assertThat(pattern).hasToString("file:**/src/main/**Foo.java");
IndexedFile indexedFile = new DefaultIndexedFile("ABCDE", baseDir, "src/main/java/org/MyFoo.java", null);
assertThat(pattern.match(indexedFile.path(), Paths.get(indexedFile.relativePath()))).isTrue();
@@ -88,7 +88,7 @@ public class PathPatternTest {
@Test
public void match_absolute_path_and_insensitive_file_extension() {
PathPattern pattern = PathPattern.create("file:**/src/main/**Foo.java");
- assertThat(pattern.toString()).isEqualTo("file:**/src/main/**Foo.java");
+ assertThat(pattern).hasToString("file:**/src/main/**Foo.java");
IndexedFile indexedFile = new DefaultIndexedFile("ABCDE", baseDir, "src/main/java/org/MyFoo.JAVA", null);
assertThat(pattern.match(indexedFile.path(), Paths.get(indexedFile.relativePath()), false)).isTrue();
@@ -104,7 +104,7 @@ public class PathPatternTest {
"file:**/src/main/**Bar.java"
});
assertThat(patterns).hasSize(2);
- assertThat(patterns[0].toString()).isEqualTo("**/src/main/**Foo.java");
- assertThat(patterns[1].toString()).isEqualTo("file:**/src/main/**Bar.java");
+ assertThat(patterns[0]).hasToString("**/src/main/**Foo.java");
+ assertThat(patterns[1]).hasToString("file:**/src/main/**Bar.java");
}
}