Пример #1
0
  @Test
  public void aNewTicketShouldHaveTheTurnNumberSubsequentToThePreviousTicket() throws Exception {
    // Arrange
    TicketDispenser ticketDispenser = new TicketDispenser();
    TurnTicket previousTicket = ticketDispenser.getTurnTicket();

    // Act
    TurnTicket newTicket = ticketDispenser.getTurnTicket();

    // Assert
    Assert.assertEquals(1, (newTicket.getTurnNumber() - previousTicket.getTurnNumber()));
  }
Пример #2
0
  @Test
  public void theNumberSequenceOfTheRegularCustomersStartsFrom2001() throws Exception {
    // Arrange
    TurnNumberSequence regularTurnNumberSequence =
        new TurnNumberSequence(TurnNumberSequence.REGULAR_CUSTOMER_FIRST_NUMBER);
    TicketDispenser regularCustomerTicketDispenser = new TicketDispenser(regularTurnNumberSequence);

    // Act
    TurnTicket ticket = regularCustomerTicketDispenser.getTurnTicket();

    // Assert
    Assert.assertEquals(TurnNumberSequence.REGULAR_CUSTOMER_FIRST_NUMBER, ticket.getTurnNumber());
  }
Пример #3
0
  @Test
  public void theNumberSequenceOfTheVipCustomersStartsFrom1001() throws Exception {
    // Arrange
    TurnNumberSequence vipCustomerTurnNumberSequence =
        new TurnNumberSequence(TurnNumberSequence.VIP_CUSTOMER_FIRST_NUMBER);
    TicketDispenser vipCustomerTicketDispenser = new TicketDispenser(vipCustomerTurnNumberSequence);

    // Act
    TurnTicket ticket = vipCustomerTicketDispenser.getTurnTicket();

    // Assert
    Assert.assertEquals(TurnNumberSequence.VIP_CUSTOMER_FIRST_NUMBER, ticket.getTurnNumber());
  }
Пример #4
0
  @Test
  public void theTicketDispenserShouldDispenseTheTicketNumber11IfGiveATurnNumber11ToIt()
      throws Exception {
    // Arrange
    MockTurnNumberSequence mockTurnNumberSequence = new MockTurnNumberSequence();
    mockTurnNumberSequence.arrangeNextTurnNumber(11);
    TicketDispenser ticketDispenser = new TicketDispenser(mockTurnNumberSequence);

    // Act
    TurnTicket ticket = ticketDispenser.getTurnTicket();

    // Assert
    Assert.assertEquals(11, ticket.getTurnNumber());
    mockTurnNumberSequence.verifyMethodGetNextTurnNumberCalledOne();
  }