]> source.dussan.org Git - sonarqube.git/commitdiff
Fix AssertJ assertions
authorPhilippe Perrin <philippe.perrin@sonarsource.com>
Thu, 10 Dec 2020 10:30:28 +0000 (11:30 +0100)
committersonartech <sonartech@sonarsource.com>
Mon, 14 Dec 2020 20:07:14 +0000 (20:07 +0000)
server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/SourceLinesHashRepositoryImplTest.java
server/sonar-main/src/test/java/org/sonar/application/command/EsJvmOptionsTest.java
server/sonar-process/src/test/java/org/sonar/process/systeminfo/JvmStateSectionTest.java
server/sonar-webserver-es/src/test/java/org/sonar/server/issue/index/IssueIndexSecurityReportsTest.java

index 1ca98731ca192ed2727a4a5d8853afbc49a06642..05fef6d04c3a7c303687a2ac33e3580f93499e28 100644 (file)
@@ -233,8 +233,8 @@ public class SourceLinesHashRepositoryImplTest {
 
     for (int i = 0; i < expectedLines.size(); i++) {
       assertThat(actualLines.get(i))
-        .isEqualTo(expectedLines.get(i))
-        .withFailMessage("Line hash is different for line %d", i);
+        .withFailMessage("Line hash is different for line %d", i)
+        .isEqualTo(expectedLines.get(i));
     }
   }
 }
index 2d51a0f540354448552ae5b5a30c2bb9e9c5efdc..d7b21dce9e8126410e3c48f5c667bffbf384d94f 100644 (file)
@@ -80,6 +80,7 @@ public class EsJvmOptionsTest {
     EsJvmOptions underTest = new EsJvmOptions(new Props(properties), tmpDir);
 
     assertThat(underTest.getAll())
+      .isNotEmpty()
       .doesNotContain("-Des.enforce.bootstrap.checks=true");
   }
 
@@ -109,6 +110,7 @@ public class EsJvmOptionsTest {
     EsJvmOptions underTest = new EsJvmOptions(new Props(properties), tmpDir);
 
     assertThat(underTest.getAll())
+      .isNotEmpty()
       .doesNotContain("-Des.enforce.bootstrap.checks=true");
   }
 
index db8ab605e18c76c944ed5819d43313674f1eaf08..3e81b2a7a393c13c03d6897613ceb61c8e206bf0 100644 (file)
@@ -54,6 +54,9 @@ public class JvmStateSectionTest {
     JvmStateSection underTest = new JvmStateSection(PROCESS_NAME);
     ProtobufSystemInfo.Section section = underTest.toProtobuf(memoryBean);
 
-    assertThat(section.getAttributesList()).extracting("key").doesNotContain("Heap Committed (MB)");
+    assertThat(section.getAttributesList())
+      .extracting("key")
+      .isNotEmpty()
+      .doesNotContain("Heap Committed (MB)");
   }
 }
index c398be4e9c743f0bba7b44fd647c687950107aa0..8ebde33671c2cd9a39f9a58ffcd9ff65842f1dca 100644 (file)
@@ -164,7 +164,9 @@ public class IssueIndexSecurityReportsTest {
   public void getOwaspTop10Report_aggregation_no_cwe() {
     List<SecurityStandardCategoryStatistics> owaspTop10Report = indexIssuesAndAssertOwaspReport(false);
 
-    assertThat(owaspTop10Report).allMatch(category -> category.getChildren().isEmpty());
+    assertThat(owaspTop10Report)
+      .isNotEmpty()
+      .allMatch(category -> category.getChildren().isEmpty());
   }
 
   @Test