From: Duarte Meneses Date: Wed, 8 Jul 2020 14:37:12 +0000 (-0500) Subject: Fix unstable unit test X-Git-Tag: 8.5.0.37579~193 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a59e6e96ad22300a795b4b6b5122da06b9623922;p=sonarqube.git Fix unstable unit test --- diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/DbVersion84.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/DbVersion84.java index feba4d4a25c..48cf7f4921d 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/DbVersion84.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/DbVersion84.java @@ -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) diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/notification/NotificationDaemonTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/notification/NotificationDaemonTest.java index 79486378771..cfb261e2c77 100644 --- a/server/sonar-webserver-core/src/test/java/org/sonar/server/notification/NotificationDaemonTest.java +++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/notification/NotificationDaemonTest.java @@ -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();