Ticket { public TicketHistory nominate(Candidate candidate, Nominator nominator) { validateTicketStatus(); doNomination(candidate); return generateHistory(candidate, nominator); } Ticket(TicketId id, TrainingId trainingId);  Ticket(TicketId id, TrainingId trainingId, TicketStatus ticketStatus);  Ticket(TicketId id, TrainingId trainingId, TicketStatus ticketStatus, String nomineeId); TicketHistory nominate(Candidate candidate, Nominator nominator); TicketStatus status(); String nomineeId(); TicketId id(); String url(); TrainingId trainingId();  }
@Test public void should_generate_ticket_history_after_ticket_was_nominated() { Ticket ticket = new Ticket(TicketId.next(), trainingId); TicketHistory ticketHistory = ticket.nominate(candidate, nominator); assertTicketHistory(ticket, ticketHistory); }
@Test public void should_throw_TicketException_given_ticket_is_not_AVAILABLE() { Ticket ticket = new Ticket(TicketId.next(), trainingId, TicketStatus.WaitForConfirm); assertThatThrownBy(() -> ticket.nominate(candidate, nominator)) .isInstanceOf(TicketException.class) .hasMessageContaining("ticket is not available"); }