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

import org.junit.jupiter.api.Test;

// Laboratorio: estas pruebas deben seguir pasando después del cambio a composición.
class UndoHistoryTest {

    @Test
    void undoReturnsActionsInReverseOrder() {
        UndoHistory h = new UndoHistory();
        h.record("vender arroz");
        h.record("reponer azúcar");
        assertEquals("reponer azúcar", h.undo());
        assertEquals("vender arroz", h.undo());
    }

    @Test
    void undoOnEmptyHistoryGivesNull() {
        assertNull(new UndoHistory().undo());
    }
}
