/**
  * Migrate object to specified version.
  *
  * @param mixed  $object       Object instance.
  * @param string $otherVersion Version name.
  *
  * @throws \LogicException
  * @throws Exception\VersionPathNotFoundException
  *
  * @return mixed Migrated object.
  */
 public function migrateToVersion($object, $otherVersion)
 {
     $className = get_class($object);
     if ($className !== $this->className) {
         throw new \LogicException('Converter for class "' . $className . '" can not migrate "' . $className . '" objects.');
     }
     $otherVersionClassName = $this->reader->getClassNameByVersion($className, $otherVersion);
     if ($otherVersionClassName) {
         $object = $this->migrateToClass($object, $otherVersionClassName);
     }
     return $object;
 }
 public function testGetClassNameByVersion()
 {
     $versionReader = new VersionReader(new AnnotationReader());
     $this->assertEquals('Evispa\\ObjectMigration\\Tests\\Mock\\MockCodeV4', $versionReader->getClassNameByVersion('Evispa\\ObjectMigration\\Tests\\Mock\\MockCodeV1', 'vnd.evispa.simple-code.v4'));
 }