AggregateRepository extends Repository<I, A> implements CommandDispatcher, EventProducingRepository, EventDispatcherDelegate { @Override public Optional<A> find(I id) throws IllegalStateException { return load(id); } protected  AggregateRepository(); @Override @OverridingMethodsMustInvokeSuper void registerWith(BoundedContext context); @Override final EventBus eventBus(); @Override A create(I id); @Override final ImmutableSet<CommandClass> messageClasses(); @Override final void dispatch(CommandEnvelope cmd); @Override ImmutableSet<EventClass> events(); @Override ImmutableSet<EventClass> domesticEvents(); @Override ImmutableSet<EventClass> externalEvents(); ImmutableSet<EventClass> importableEvents(); @Override ImmutableSet<EventClass> outgoingEvents(); @Override void dispatchEvent(EventEnvelope event); @Override Optional<A> find(I id); @OverridingMethodsMustInvokeSuper @Override void close();  }
@Test @DisplayName("not create new aggregates upon lookup") void notCreateNewAggregatesOnFind() { ProjectId newId = Sample.messageOfType(ProjectId.class); Optional<ProjectAggregate> optional = repository().find(newId); assertFalse(optional.isPresent()); }