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 @Override
public NotificationState send(String message) { public String makeContent(String message) {
try { try {
Thread.sleep(delay); Thread.sleep(delay);
} catch (InterruptedException e) { } catch (InterruptedException e) {
System.err.println("Cannot wait for differed strategy"); 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 { public class FastSendNotificationStrategy implements SendNotificationStrategy {
@Override @Override
public NotificationState send(String message) { public String makeContent(String message) {
System.out.println(message); return message;
return NotificationState.SENT;
} }
} }

View File

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

View File

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