public function testResourceRepository()
 {
     $entityManager = $this->createEntityManagerMock();
     $entityManager->expects($this->exactly(3))->method('getClassMetadata')->with($this->identicalTo($entityName = 'entity'))->will($this->returnValue($classMetadata = $this->createClassMetadataMock()));
     $classMetadata->expects($this->exactly(3))->method('getName')->will($this->returnValue($entityName));
     $this->resourceRegistry->expects($this->once())->method('getIterator')->will($this->returnValue(new \ArrayIterator([$resource = $this->createResourceMock()])));
     $resource->expects($this->once())->method('getModel')->will($this->returnValue($entityName));
     $classMetadata->customRepositoryClassName = $repositoryClass = Repository::class;
     $this->assertInstanceOf($repositoryClass, $repository = $this->repositoryFactory->getRepository($entityManager, $entityName));
     $this->assertSame($repository, $this->repositoryFactory->getRepository($entityManager, $entityName));
 }