/**
  * @test
  */
 public function it_can_be_created_from_array()
 {
     $status = MessageStatus::fromArray(["status" => MessageStatus::FAILED, "failure_msg" => "Message failed"]);
     $this->assertTrue($status->isFailed());
     $this->assertEquals(MessageStatus::FAILED, $status->toString());
     $this->assertEquals("Message failed", $status->failureMsg());
 }
 /**
  * @param array $messageLogEntryArr
  * @return MessageLogEntry
  * @throws \InvalidArgumentException
  */
 public static function fromArray(array $messageLogEntryArr)
 {
     if (!array_key_exists("message_id", $messageLogEntryArr)) {
         throw new \InvalidArgumentException('Message id missing in status array');
     }
     if (!array_key_exists("message_name", $messageLogEntryArr)) {
         throw new \InvalidArgumentException('Message name missing in status array');
     }
     if (!array_key_exists("version", $messageLogEntryArr)) {
         throw new \InvalidArgumentException('Message version missing in status array');
     }
     if (!array_key_exists("logged_at", $messageLogEntryArr)) {
         throw new \InvalidArgumentException('Message logged at missing in status array');
     }
     if (!array_key_exists("task_list_position", $messageLogEntryArr)) {
         throw new \InvalidArgumentException('Message task list position missing in status array');
     }
     if (!array_key_exists("process_id", $messageLogEntryArr)) {
         throw new \InvalidArgumentException('Message process id missing in status array');
     }
     if (!array_key_exists("status", $messageLogEntryArr)) {
         throw new \InvalidArgumentException('Message status missing in status array');
     }
     if (!array_key_exists("failure_msg", $messageLogEntryArr)) {
         throw new \InvalidArgumentException('Status failure msg position on missing in status array');
     }
     $status = MessageStatus::fromArray($messageLogEntryArr);
     $taskListPosition = is_null($messageLogEntryArr["task_list_position"]) ? null : TaskListPosition::fromString($messageLogEntryArr["task_list_position"]);
     $processId = is_null($messageLogEntryArr["process_id"]) ? null : ProcessId::fromString($messageLogEntryArr["process_id"]);
     return new self(Uuid::fromString($messageLogEntryArr["message_id"]), $messageLogEntryArr["message_name"], (int) $messageLogEntryArr["version"], \DateTime::createFromFormat('Y-m-d\\TH:i:s.uO', $messageLogEntryArr["logged_at"]), $status, $taskListPosition, $processId);
 }