fix flaky StorageTest.testNotificationStorage() (FINERACT-828)
This commit is contained in:
committed by
Michael Vorburger ⛑️
parent
439ba93ebd
commit
2aca64056a
@@ -16,7 +16,6 @@
|
|||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.apache.fineract.notification;
|
package org.apache.fineract.notification;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
@@ -72,7 +71,6 @@ public class StorageTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNotificationStorage() {
|
public void testNotificationStorage() {
|
||||||
|
|
||||||
Long userId = 1L;
|
Long userId = 1L;
|
||||||
String objectType = "CLIENT";
|
String objectType = "CLIENT";
|
||||||
Long objectIdentifier = 1L;
|
Long objectIdentifier = 1L;
|
||||||
@@ -80,6 +78,7 @@ public class StorageTest {
|
|||||||
Long actor = 1L;
|
Long actor = 1L;
|
||||||
String notificationContent = "A client was created";
|
String notificationContent = "A client was created";
|
||||||
boolean isSystemGenerated = false;
|
boolean isSystemGenerated = false;
|
||||||
|
String now = getCurrentDateTime();
|
||||||
|
|
||||||
Notification notification = new Notification(
|
Notification notification = new Notification(
|
||||||
objectType,
|
objectType,
|
||||||
@@ -88,20 +87,20 @@ public class StorageTest {
|
|||||||
actor,
|
actor,
|
||||||
isSystemGenerated,
|
isSystemGenerated,
|
||||||
notificationContent,
|
notificationContent,
|
||||||
getCurrentDateTime()
|
now
|
||||||
);
|
);
|
||||||
|
|
||||||
AppUser appUser = new AppUser(null, new User("J.J.", "", true, true,
|
AppUser appUser = new AppUser(null, new User("J.J.", "", true, true,
|
||||||
true, true, Collections.emptyList()),
|
true, true, Collections.emptyList()),
|
||||||
null, "user@com", "John", "", null, false,
|
null, "user@com", "John", "", null, false,
|
||||||
false, null);
|
false, null);
|
||||||
|
|
||||||
NotificationMapper notificationMapper = new NotificationMapper(
|
NotificationMapper notificationMapper = new NotificationMapper(
|
||||||
notification,
|
notification,
|
||||||
appUser,
|
appUser,
|
||||||
false,
|
false,
|
||||||
getCurrentDateTime()
|
now
|
||||||
);
|
);
|
||||||
|
|
||||||
when(this.notificationGeneratorWritePlatformService.create(refEq(notification))).thenReturn(1L);
|
when(this.notificationGeneratorWritePlatformService.create(refEq(notification))).thenReturn(1L);
|
||||||
|
|
||||||
@@ -120,9 +119,9 @@ public class StorageTest {
|
|||||||
actor,
|
actor,
|
||||||
notificationContent,
|
notificationContent,
|
||||||
isSystemGenerated
|
isSystemGenerated
|
||||||
);
|
);
|
||||||
|
|
||||||
verify(this.notificationGeneratorWritePlatformService, times(1)).create(refEq(notification));
|
verify(this.notificationGeneratorWritePlatformService, times(1)).create(refEq(notification, "createdAt"));
|
||||||
verify(this.notificationMapperWritePlatformService, times(1)).create(refEq(notificationMapper));
|
verify(this.notificationMapperWritePlatformService, times(1)).create(refEq(notificationMapper));
|
||||||
verify(this.notificationGeneratorReadRepositoryWrapper, times(1)).findById(1L);
|
verify(this.notificationGeneratorReadRepositoryWrapper, times(1)).findById(1L);
|
||||||
assertEquals(actualGeneratedNotificationId, Long.valueOf(1));
|
assertEquals(actualGeneratedNotificationId, Long.valueOf(1));
|
||||||
|
|||||||
Reference in New Issue
Block a user