/**
  * ColorMaker constructor.
  * @param $hex
  * @throws InvalidHexException
  */
 public function __construct($hex)
 {
     $hex = HexValidator::validateHex($hex);
     if ($name = ColorList::getNameFromHex($hex)) {
         $this->color = new Color($hex, $name, $hex);
     } else {
         $newHex = $this->getClosestHex($hex);
         if ($name = ColorList::getNameFromHex($newHex)) {
             $this->color = new Color($hex, $name, $newHex);
         } else {
             throw new InvalidHexException($hex);
         }
     }
 }
 public function testValidateInvalidHex()
 {
     $this->expectException('\\AlistairShaw\\NameTheColor\\Exceptions\\InvalidHexException');
     HexValidator::validateHex('#asfasfasf');
 }