Refactor: Make the sending strategy match the new Notification logic

This commit is contained in:
Namu
2025-10-06 09:12:42 +02:00
parent 5a97669665
commit 3065d1bfe3
4 changed files with 9 additions and 11 deletions

View File

@@ -8,14 +8,14 @@ public class DifferedSendNotificationStrategy implements SendNotificationStrateg
}
@Override
public NotificationState send(String message) {
public String makeContent(String message) {
try {
Thread.sleep(delay);
} catch (InterruptedException e) {
System.err.println("Cannot wait for differed strategy");
return NotificationState.KO;
message = "";
}
System.out.println(message);
return NotificationState.SENT;
return message;
}
}

View File

@@ -2,8 +2,7 @@ package utils;
public class FastSendNotificationStrategy implements SendNotificationStrategy {
@Override
public NotificationState send(String message) {
System.out.println(message);
return NotificationState.SENT;
public String makeContent(String message) {
return message;
}
}

View File

@@ -8,8 +8,7 @@ public class SecureSendNotificationStrategy implements SendNotificationStrategy
}
@Override
public NotificationState send(String message) {
System.out.println(key+"Flcjsdjknesdlkgjsilkqzfjazio"+message+"kjhsdiuhisehifsdhfiuhsuidhuifhjsid");
return NotificationState.SENT;
public String makeContent(String message) {
return key+"Flcjsdjknesdlkgjsilkqzfjazio"+message+"kjhsdiuhisehifsdhfiuhsuidhuifhjsid";
}
}

View File

@@ -1,5 +1,5 @@
package utils;
public interface SendNotificationStrategy {
NotificationState send(String message);
String makeContent(String message);
}