package com.ankurm.testing;

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

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

class ShoppingCartTest {

    private ShoppingCart cart;

    @BeforeEach
    void init() {
        // This runs before EACH @Test method
        System.out.println("DEBUG: Setting up a fresh shopping cart...");
        cart = new ShoppingCart();
    }

    @Test
    @DisplayName("Should increment size when item is added")
    void testAddItem() {
        System.out.println("DEBUG: Running testAddItem");
        cart.addItem("Laptop");
        assertEquals(1, cart.getSize());
    }

    @Test
    @DisplayName("New cart should have zero items")
    void testCartIsInitiallyEmpty() {
        System.out.println("DEBUG: Running testCartIsInitiallyEmpty");
        assertEquals(0, cart.getSize());
    }
}
