@Test
public void testInitializeFromAggregateSnapshot() {
StubAggregate aggregate = new StubAggregate("stubId");
aggregate.doSomething();
aggregate.commitEvents();
DomainEventMessage<StubAggregate> snapshotMessage = new GenericDomainEventMessage<StubAggregate>(
aggregate.getIdentifier(), aggregate.getVersion(), aggregate);
GenericAggregateFactory<StubAggregate> factory = new GenericAggregateFactory<StubAggregate>(StubAggregate.class);
assertEquals("StubAggregate", factory.getTypeIdentifier());
assertSame(aggregate, factory.createAggregate(aggregate.getIdentifier(), snapshotMessage));