public function testSetErrorMessage()
 {
     $ErrorMessages = getProperty('MailForm', 'ErrorMessages');
     $ErrorCode = getProperty('MailForm', 'ErrorCode');
     $mailform = new MailForm();
     $this->assertFalse($mailform->isError());
     $mailform->setErrorMessage(MailForm::BASE_ERROR_KEY, MailForm::ERROR_CODE_OK);
     $errorMessages = $ErrorMessages->getValue($mailform);
     $this->assertCount(0, $errorMessages);
     $mailform->setErrorMessage('key', MailForm::ERROR_CODE_NOT_NULL_PARAM, "title");
     $this->assertEquals(MailForm::ERROR_CODE_NOT_NULL_PARAM, $ErrorCode->getValue($mailform));
     $errorMessages = $ErrorMessages->getValue($mailform);
     $this->assertArrayHasKey('key', $errorMessages);
     $this->assertEquals('「title」は必ず入力してください。', $errorMessages['key']);
     $mailform->setErrorMessage('key2', 100000, "title2");
     $this->assertEquals(100000, $ErrorCode->getValue($mailform));
     $errorMessages = $ErrorMessages->getValue($mailform);
     $this->assertCount(2, $errorMessages);
     $this->assertArrayHasKey('key2', $errorMessages);
     $this->assertEquals('エラーが発生しています。', $errorMessages['key2']);
     $mailform->setErrorMessage(MailForm::BASE_ERROR_KEY, MailForm::ERROR_CODE_INVALID_FORM_CONFIG);
     $this->assertEquals(MailForm::ERROR_CODE_INVALID_FORM_CONFIG, $ErrorCode->getValue($mailform));
     $errorMessages = $ErrorMessages->getValue($mailform);
     $this->assertCount(1, $errorMessages);
     $this->assertArrayHasKey(MailForm::BASE_ERROR_KEY, $errorMessages);
     $this->assertEquals('システムエラーが発生しました。', $errorMessages[MailForm::BASE_ERROR_KEY]);
 }