docs: update session facade

This commit is contained in:
Ilkka Seppälä
2025-04-15 21:48:41 +03:00
parent bc42e38938
commit 67bc5e3a62
4 changed files with 68 additions and 65 deletions
@@ -27,7 +27,7 @@ package com.iluwatar.sessionfacade;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
/** The type App test. */
public class AppTest {
class AppTest {
/** Should execute application without exception. */
@org.junit.jupiter.api.Test
@@ -27,13 +27,13 @@ package com.iluwatar.sessionfacade;
import static org.mockito.Mockito.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.slf4j.Logger;
/** The type Payment service test. */
class PaymentServiceTest {
private PaymentService paymentService;
private OrderService orderService;
private Logger mockLogger;
/** Sets up. */
@@ -44,27 +44,14 @@ class PaymentServiceTest {
paymentService.LOGGER = mockLogger;
}
/** Test select cash payment method. */
@Test
void testSelectCashPaymentMethod() {
String method = "cash";
@ParameterizedTest
@CsvSource({
"cash, Client have chosen cash payment option",
"credit, Client have chosen credit card payment option",
"cheque, Unspecified payment method type"
})
void testSelectPaymentMethod(String method, String expectedLogMessage) {
paymentService.selectPaymentMethod(method);
verify(mockLogger).info("Client have chosen cash payment option");
}
/** Test select credit card payment method. */
@Test
void testSelectCreditCardPaymentMethod() {
String method = "credit";
paymentService.selectPaymentMethod(method);
verify(mockLogger).info("Client have chosen credit card payment option");
}
/** Test select unspecified payment method. */
@Test
void testSelectUnspecifiedPaymentMethod() {
String method = "cheque";
paymentService.selectPaymentMethod(method);
verify(mockLogger).info("Unspecified payment method type");
verify(mockLogger).info(expectedLogMessage);
}
}