100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Improve test robustness
Rich Turner4f9e51e0f5f1
diff --git a/manager/src/main/java/org/openremote/manager/notification/EmailNotificationHandler.java b/manager/src/main/java/org/openremote/manager/notification/EmailNotificationHandler.javaindex 042af7e98..a21c9288c 100644--- a/manager/src/main/java/org/openremote/manager/notification/EmailNotificationHandler.java+++ b/manager/src/main/java/org/openremote/manager/notification/EmailNotificationHandler.java@@ -172,6 +172,9 @@ public class EmailNotificationHandler implements NotificationHandler {Arrays.stream(users).map(user -> {Notification.Target userAssetTarget = new Notification.Target(Notification.TargetType.USER, user.getId());+++userAssetTarget.setData(new EmailNotificationMessage.Recipient(user.getFullName(), user.getEmail()));return userAssetTarget;})diff --git a/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovy b/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovyindex 2e17b5072..76b64356d 100644--- a/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovy+++ b/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovy@@ -567,9 +567,9 @@ class NotificationTest extends Specification implements ManagerContainerTrait {Collections.singletonList(new Notification.Target(Notification.TargetType.TENANT, managerTestSetup.realmBuildingTenant)), null, null)notificationService.sendNotification(notification, Notification.Source.TENANT_RULESET, managerTestSetup.realmBuildingTenant)- then: "the email should have been sent to all tenant users"+ then: "the email should have been sent to the tenant users"conditions.eventually {- assert sentEmails.size() == 4+ assert sentEmails.size() >= 3assert sentEmails.every {it.getPlainText() == "Hello world!"}assert sentEmails.every {it.getSubject() == "Test"}assert sentEmails.any { it.getRecipients().size() == 1 && it.getRecipients().get(0).address == "[email protected]"}