diff --git a/RefactoringToDesignPatterns/StrategyPatternPractice/Task/task.md b/RefactoringToDesignPatterns/StrategyPatternPractice/Task/task.md
index cccabec..6222fe4 100644
--- a/RefactoringToDesignPatterns/StrategyPatternPractice/Task/task.md
+++ b/RefactoringToDesignPatterns/StrategyPatternPractice/Task/task.md
@@ -9,8 +9,8 @@
This class should take as a constructor parameter `paymentStrategy: PaymentStrategy`
and should contain the `processOrderPayment` method, which invokes the `processPayment` method from `paymentStrategy`.
- Transform the `Order` class into a `data class` that encapsulates details regarding the order's price and date.
-- Within the `Main::main` method, for every payment type, instantiate a `PaymentProcessor`. Ensure you pass the
- corresponding payment strategy during the object's creation.
+- Within the `Main::main` method, instantiate an `Order` object for each order and a `PaymentProcessor` for each payment type.
+ Make sure to pass the corresponding payment strategy when creating the `PaymentProcessor` object.
By using the **Strategy** design pattern, the payment processing logic is separated from the `Order` class,
making it more flexible and maintainable.
@@ -52,13 +52,15 @@ class CreditCardPayment : PaymentStrategy {
-In the main method, you should instantiate a `PaymentProcessor` object and provide the appropriate payment strategy as
-an
-argument. For instance, for a credit card payment type, the code would be:
+In the main method, **for each order**, you should instantiate an `Order` object, providing it with the corresponding total amount and date.
+Then, you need to instantiate a `PaymentProcessor` object, supplying it with the appropriate payment strategy as an argument.
+Finally, you should invoke the `processOrderPayment()` method.
+For example, the code for processing a payment with a credit card would be:
```kotlin
+val order1 = Order(100.0, LocalDate.of(2023, 3, 1))
val creditCardPayment = PaymentProcessor(CreditCardPayment())
-creditCardPayment.processOrderPayment(100.0)
+creditCardPayment.processOrderPayment(order1.totalAmount)
```
\ No newline at end of file
diff --git a/RefactoringToDesignPatterns/StrategyPatternPractice/Task/test/Tests.kt b/RefactoringToDesignPatterns/StrategyPatternPractice/Task/test/Tests.kt
index d88025b..6e552cd 100644
--- a/RefactoringToDesignPatterns/StrategyPatternPractice/Task/test/Tests.kt
+++ b/RefactoringToDesignPatterns/StrategyPatternPractice/Task/test/Tests.kt
@@ -108,21 +108,21 @@ class StrategyPatternTest : BaseIjTestClass() {
findMethodUsages(method),
listOf("main")
) {
- "Please, invoke the $method method of Credit Card Payment in the main method"
+ "Please, invoke the $method method of Credit Card Payment and pass in the totalAmount from the first order within the main method"
}
method = "processOrderPayment(order2.totalAmount)"
Assertions.assertEquals(
findMethodUsages(method),
listOf("main")
) {
- "Please, invoke the $method method of PayPal Payment in the main method"
+ "Please, invoke the $method method of PayPal Payment and pass in the totalAmount from the second order within the main method"
}
method = "processOrderPayment(order3.totalAmount)"
Assertions.assertEquals(
findMethodUsages(method),
listOf("main")
) {
- "Please, invoke the $method method of Bitcoin Payment in the main method"
+ "Please, invoke the $method method of Bitcoin Payment and pass in the totalAmount from the third order within the main method"
}
}
}
\ No newline at end of file