DefaultDocumentRepositoryAsyncProducer implements DocumentRepositoryAsyncProducer { @Override public <E, ID, T extends RepositoryAsync<E, ID>> T get(Class<T> repositoryClass, DocumentCollectionManagerAsync manager) { Objects.requireNonNull(repositoryClass, "repository class is required"); Objects.requireNonNull(manager, "manager class is required"); DocumentTemplateAsync template = producer.get(manager); return get(repositoryClass, template); }  @Override T get(Class<T> repositoryClass, DocumentCollectionManagerAsync manager); @Override T get(Class<T> repositoryClass, DocumentTemplateAsync template);  }
@Test public void shouldCreateFromManager() { DocumentCollectionManagerAsync manager= Mockito.mock(DocumentCollectionManagerAsync.class); PersonRepositoryAsync personRepository = producer.get(PersonRepositoryAsync.class, manager); assertNotNull(personRepository); }
@Test public void shouldCreateFromTemplate() { DocumentTemplateAsync template= Mockito.mock(DocumentTemplateAsync.class); PersonRepositoryAsync personRepository = producer.get(PersonRepositoryAsync.class, template); assertNotNull(personRepository); }