1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include <gtest/gtest.h> 17 #include <map> 18 19 #include "errorcode_convertor.h" 20 #include "net_manager_constants.h" 21 22 namespace OHOS { 23 namespace NetManagerStandard { 24 namespace { 25 using namespace testing::ext; 26 } // namespace 27 28 class ErrorCodeConvertorTest : public testing::Test { 29 public: 30 static void SetUpTestCase(); 31 static void TearDownTestCase(); 32 void SetUp(); 33 void TearDown(); 34 }; 35 SetUpTestCase()36void ErrorCodeConvertorTest::SetUpTestCase() {} 37 TearDownTestCase()38void ErrorCodeConvertorTest::TearDownTestCase() {} 39 SetUp()40void ErrorCodeConvertorTest::SetUp() {} 41 TearDown()42void ErrorCodeConvertorTest::TearDown() {} 43 44 HWTEST_F(ErrorCodeConvertorTest, ConvertErrorCodeTest001, TestSize.Level1) 45 { 46 int32_t testErrorCode = 5445645; 47 auto instance = std::make_unique<NetBaseErrorCodeConvertor>(); 48 int32_t errorCode = NETMANAGER_ERR_INTERNAL; 49 auto ret = instance->ConvertErrorCode(errorCode); 50 ASSERT_FALSE(ret.empty()); 51 ret = instance->ConvertErrorCode(testErrorCode); 52 ASSERT_TRUE(ret.empty()); 53 } 54 } // namespace NetManagerStandard 55 } // namespace OHOS