--- /dev/null
+/*
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "test_constant.h"
+#include "test_common.h"
+#include "test_macros.h"
+#include "vcore/PluginHandler.h"
+#include <string>
+#include <iostream>
+#include <stdio.h>
+#include <stdlib.h>
+
+using namespace ValidationCore;
+
+BOOST_AUTO_TEST_SUITE(T_VCORE_PLUGIN_HANDLE)
+
+POSITIVE_TEST_CASE(T_plugin_handle_errorToString)
+{
+ PluginHandler plugin;
+ std::string code = plugin.errorToString(E_SIG_NONE);
+ BOOST_CHECK_EQUAL(code, "Plugin errorstring code : 0");
+}
+
+struct RenameFileFixture {
+ std::string INVALID_PLUGIN_PATH = LIB_DIR + std::string("/libcert-svc-validator-plugin.sobin");
+
+ RenameFileFixture() {
+ if (std::rename(PLUGIN_PATH.c_str(), INVALID_PLUGIN_PATH.c_str()) != 0) {
+ BOOST_FAIL("This file cannot be renamed before running the test!");
+ }
+ }
+
+ ~RenameFileFixture() {
+ if (std::rename(INVALID_PLUGIN_PATH.c_str(), PLUGIN_PATH.c_str()) != 0) {
+ BOOST_FAIL("This file cannot be renamed after running the test!");
+ }
+ }
+};
+
+BOOST_FIXTURE_TEST_CASE(T_plugin_not_init, RenameFileFixture)
+{
+ PluginHandler plugin;
+ VCerr vcerrCode;
+ std::string stringCode;
+
+ SignatureData signatureData;
+ vcerrCode = plugin.step(E_SIG_PLUGIN, signatureData);
+ BOOST_CHECK_EQUAL(vcerrCode, E_SIG_PLUGIN);
+
+ stringCode = plugin.errorToString(E_SIG_NONE);
+ BOOST_CHECK_EQUAL(stringCode, "Plugin is not initialized");
+}
+
+BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file