Commit e9ecc569 authored by Angelo Veltens's avatar Angelo Veltens

use unique code generation strategy in acceptance test

parent bea85c3e
package de.codecentric.ticketscanner;
import de.codecentric.ticketscanner.persistence.TicketRepository;
import org.hibernate.cfg.NotYetImplementedException;
import org.springframework.stereotype.Component;
@Component
public class UniqueCodeGenerationStrategy implements CodeGenerationStrategy{
private final TicketRepository repository;
public UniqueCodeGenerationStrategy(TicketRepository repository) {
this.repository = repository;
}
@Override
public String next() {
throw new NotYetImplementedException();
......
......@@ -22,7 +22,7 @@ class TicketScannerFeature {
void successful_check_in_with_valid_ticket() {
// given
RegisteredTickets registeredTickets = new RegisteredTickets(repository);
CodeGenerator codeGenerator = new CodeGenerator(new StaticCodeGenerationStrategy("WHATEVER"));
CodeGenerator codeGenerator = new CodeGenerator(new UniqueCodeGenerationStrategy(repository));
TicketScanner ticketScanner = new TicketScanner(codeGenerator, registeredTickets);
Ticket registeredTicket = new Ticket(UUID.randomUUID());
// when
......@@ -30,7 +30,7 @@ class TicketScannerFeature {
Ticket scannedTicket = ticketScanner.scan(generatedCode);
CheckIn checkIn = ticketScanner.checkIn(generatedCode);
// then
assertThat(generatedCode).isEqualTo(new Code("WHATEVER"));
assertThat(generatedCode).isNotNull();
assertThat(scannedTicket).isEqualTo(registeredTicket);
assertThat(checkIn.isSuccessful()).isTrue();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment