import org.junit.jupiter.api.*;

import static org.junit.jupiter.api.Assertions.assertEquals;

//@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class BankAccountBeforeAndAfter {
    static BankAccount bankAccount;

    @BeforeAll
    static void beforeAll() {
        System.out.println("HI");
        bankAccount = BankAccount.builder()
                .balance(500.00)
                .minimumBalance(0.00).build();
    }

    @BeforeEach
    void setUp() {
        System.out.println("Before Each");
    }

    @AfterEach
    void tearDown() {
        System.out.println("After Each");
    }

    @Test
    @DisplayName("test withdraw")
    void testWithdraw() {
        bankAccount.withDraw(300.00);
        assertEquals(200.00, bankAccount.getBalance());
    }

    @Test
    @DisplayName("test deposit")
    void testDeposit() {
        bankAccount.deposit(500.00);
        assertEquals(700.00, bankAccount.getBalance());
    }

    @AfterAll
    static void afterAll() {
        System.out.println("Bye!");
    }
}