Refactor: Make the sending strategy match the new Notification logic
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package utils;
|
||||
|
||||
public interface SendNotificationStrategy {
|
||||
NotificationState send(String message);
|
||||
String makeContent(String message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user