package oving5.ticket; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; public class SingleTicketTest { private Ticket ticket; @BeforeEach public void setUp() { ticket = new SingleTicket(); } @Test @DisplayName("Check that the ticket returns true when scanned for the first time") public void testReturnsTrueWhenScanned() { assertTrue(this.ticket.scan(), "The ticket should return true when scanned for the first time"); } @Test @DisplayName("Check that the ticket returns false when scanned for the second time") public void testReturnsFalseWhenScannedTwice() { ticket.scan(); assertFalse(ticket.scan(), "The ticket should return false when scanned for the second time"); } @Test @DisplayName("Check that the ticket returns true when scanned for the first time after reset") public void testReturnsFalseWhenScannedTwiceAfterReset() { ticket.scan(); ticket = new SingleTicket(); assertTrue(ticket.scan(), "The ticket should return true when scanned for the first time after reset"); } }