]> source.dussan.org Git - sonarqube.git/commitdiff
Fix unstable unit test
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Wed, 8 Jul 2020 14:37:12 +0000 (09:37 -0500)
committersonartech <sonartech@sonarsource.com>
Fri, 10 Jul 2020 20:05:50 +0000 (20:05 +0000)
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/DbVersion84.java
server/sonar-webserver-core/src/test/java/org/sonar/server/notification/NotificationDaemonTest.java

index feba4d4a25c207fa8ad8944523f1e17068c54c2f..48cf7f4921db54ffcd994e5b43cc8dc2c353250c 100644 (file)
@@ -694,7 +694,7 @@ public class DbVersion84 implements DbVersion {
       .add(3647, "Make 'user_uuid' not-null for 'ORGANIZATION_MEMBERS'", MakeOrganizationMembersUserUuidColumnNotNullable.class)
       .add(3648, "Drop index on 'user_id' column of 'ORGANIZATION_MEMBERS' table", DropIndexOnUserIdOfOrganizationMembersTable.class)
       .add(3649, "Add index on 'user_uuid' column of 'ORGANIZATION_MEMBERS' table", AddIndexOnUserUuidOfOrganizationMembersTable.class)
-      .add(3650, "Drop index on 'user_id', 'group_id' columns of 'ORGANIZATION_MEMBERS' table", DropPrimaryKeyOnUserIdAndOrganizationUuidOfOrganizationMembersTable.class)
+      .add(3650, "Drop primary key on 'user_id' column of 'ORGANIZATION_MEMBERS' table", DropPrimaryKeyOnUserIdAndOrganizationUuidOfOrganizationMembersTable.class)
       .add(3651, "Add PK on 'user_uuid', 'organization_uuid' columns of 'ORGANIZATION_MEMBERS' table", AddPrimaryKeyOnUserUuidAndOrganizationUuidColumnsOfUserRolesTable.class)
       .add(3652, "Drop column on 'user_id' column of 'ORGANIZATION_MEMBERS' table", DropUserIdColumnOfOrganizationMembersTable.class)
 
index 794863787712fd9dea3b8ebfbbf6eebcc8814058..cfb261e2c77e54abb2e4cbb7b9869fe8fd26cc8b 100644 (file)
@@ -34,6 +34,7 @@ import static java.util.Collections.singleton;
 import static org.mockito.ArgumentMatchers.anyCollection;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.timeout;
+import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 public class NotificationDaemonTest {
@@ -71,7 +72,9 @@ public class NotificationDaemonTest {
     when(manager.getFromQueue()).thenReturn(notification).thenReturn(null);
 
     underTest.start();
-    inOrder.verify(notificationService, timeout(2000)).deliverEmails(singleton(notification));
+    verify(notificationService, timeout(2000)).deliver(notification);
+
+    inOrder.verify(notificationService).deliverEmails(singleton(notification));
     inOrder.verify(notificationService).deliver(notification);
     inOrder.verifyNoMoreInteractions();
     underTest.stop();
@@ -91,13 +94,15 @@ public class NotificationDaemonTest {
       .thenReturn(null);
 
     underTest.start();
-    inOrder.verify(notificationService, timeout(2000)).deliverEmails(singleton(notification1));
+    verify(notificationService, timeout(2000)).deliver(notification1);
+
+    inOrder.verify(notificationService).deliverEmails(singleton(notification1));
     inOrder.verify(notificationService).deliver(notification1);
-    inOrder.verify(notificationService, timeout(2000)).deliverEmails(singleton(notification2));
+    inOrder.verify(notificationService).deliverEmails(singleton(notification2));
     inOrder.verify(notificationService).deliver(notification2);
-    inOrder.verify(notificationService, timeout(2000)).deliverEmails(singleton(notification3));
+    inOrder.verify(notificationService).deliverEmails(singleton(notification3));
     inOrder.verify(notificationService).deliver(notification3);
-    inOrder.verify(notificationService, timeout(2000)).deliverEmails(singleton(notification4));
+    inOrder.verify(notificationService).deliverEmails(singleton(notification4));
     inOrder.verify(notificationService).deliver(notification4);
     inOrder.verifyNoMoreInteractions();
     underTest.stop();