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
|
@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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
package utils;
|
package utils;
|
||||||
|
|
||||||
public interface SendNotificationStrategy {
|
public interface SendNotificationStrategy {
|
||||||
NotificationState send(String message);
|
String makeContent(String message);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user