### Question:
AggregateRootHistory implements Serializable { public void markAsPersisted(UnitOfWork uow) { checkArgument(unitsOfWork.contains(uow), "unitOfWork must be part of this AggregateRootHistory in order to be marked as persisted"); persisted.add(uow); } AggregateRootHistory(); List<Event> getAllEvents(); List<Event> getEventsAfterUntil(long afterVersion, long untilVersion); List<Event> getEventsUntil(long version); Long getLastVersion(); void add(final UnitOfWork transaction); UnitOfWork getLastUnitOfWork(); List<UnitOfWork> getPendingOfPersistence(); void markAsPersisted(UnitOfWork uow);  }### Answer:
@Test public void markAsPersisted() { UUID id = UUID.randomUUID(); AggregateRootHistory transactions = new AggregateRootHistory(); Command command = new CommandJustForTest(UUID.randomUUID(), id, 0L); Event event1 = new EventJustForTest(id, 1); UnitOfWork uow = UnitOfWork.create(UUID.randomUUID(), command, Arrays.asList(event1)); transactions.add(uow); assertThat(transactions.getPendingOfPersistence(), contains(uow)); transactions.markAsPersisted(uow); assertThat(transactions.getPendingOfPersistence(), emptyCollectionOf(UnitOfWork.class)); }