mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-18 05:25:45 +00:00
docs: update session facade
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user