code: public function getStateMessage($testSession)
      {
          if ($testSession instanceof AssessmentTestSession) {
              switch ($testSession->getState()) {
                  case AssessmentTestSessionState::SUSPENDED:
                      return $this->getPausedStateMessage($testSession);
                      
                  case AssessmentTestSessionState::CLOSED:
                      return $this->getTerminatedStateMessage($testSession);
                      
                  case AssessmentTestSessionState::INITIAL:
                      return $this->getInitialStateMessage($testSession);
                      
                  default:
                      return $this->getRunningStateMessages($testSession);
              }             
          } else {
              throw new \common_exception_InvalidArgumentType(
                  'QtiRunnerMessageService',
                  'getStateMessage',
                  0,
                  'qtism\runtime\tests\AssessmentTestSession',
                  $testSession
              );
          }
      }
docs: Gets a message related to the state of the assessment test session
  @param mixed $testSession
  @return string
  @throws \common_exception_InvalidArgumentType