DefaultDocumentRepositoryProducer implements DocumentRepositoryProducer { @Override public <E, ID, T extends Repository<E, ID>> T get(Class<T> repositoryClass, DocumentCollectionManager manager) { Objects.requireNonNull(repositoryClass, "repository class is required"); Objects.requireNonNull(manager, "manager class is required"); DocumentTemplate template = producer.get(manager); return get(repositoryClass, template); }  @Override T get(Class<T> repositoryClass, DocumentCollectionManager manager); @Override T get(Class<T> repositoryClass, DocumentTemplate template);  }
@Test public void shouldCreateFromManager() { DocumentCollectionManager manager= Mockito.mock(DocumentCollectionManager.class); PersonRepository personRepository = producer.get(PersonRepository.class, manager); assertNotNull(personRepository); }
@Test public void shouldCreateFromTemplate() { DocumentTemplate template= Mockito.mock(DocumentTemplate.class); PersonRepository personRepository = producer.get(PersonRepository.class, template); assertNotNull(personRepository); }