Feat: We can play the code multiple times with different message
Some checks failed
SonarQube Scan / SonarQube Trigger (push) Failing after 19s

This commit is contained in:
Namu
2025-10-06 11:06:01 +02:00
parent 9e3b3cdf58
commit ca88a009a0
3 changed files with 7 additions and 4 deletions

View File

@@ -2,7 +2,10 @@ import utils.*;
public class Application {
public void run() {
SendNotificationFacade.sendNotifications();
String[] messages = new String[]{"Bonjour", "You got mail", "Je préfère C#", "Fin !"};
for (final String message: messages) {
SendNotificationFacade.sendNotifications(message);
}
}
}

View File

@@ -69,7 +69,7 @@ public abstract class Notification {
for (final NotificationDecoration decoration : decorations)
content = decoration.transformContent(content);
return strategy.makeContent(content);
return strategy.makeContent(content) + "\n";
}
setKoState();
return "";

View File

@@ -12,7 +12,7 @@ import static utils.NotificationType.Mail;
import static utils.NotificationType.Sms;
public class SendNotificationFacade {
public static void sendNotifications() {
public static void sendNotifications(String message) {
var notificationManager = NotificationManager.getInstance();
NotificationType[] typesThomas = {Sms, Mail, Push};
@@ -27,6 +27,6 @@ public class SendNotificationFacade {
notificationManager.getObservable().addSubscribers(thomas);
notificationManager.getObservable().addSubscribers(alexandre);
notificationManager.getObservable().sendNotifications("Je préfère C#");
notificationManager.getObservable().sendNotifications(message);
}
}