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 #include <iostream>
16 #include "dm_adapter_manager.h"
17 #include "dm_config_manager.h"
18 #include "UTTest_dm_adapter_manager.h"
19 
20 namespace OHOS {
21 namespace DistributedHardware {
SetUp()22 void DmAdapterManagerTest::SetUp()
23 {
24 }
TearDown()25 void DmAdapterManagerTest::TearDown()
26 {
27 }
SetUpTestCase()28 void DmAdapterManagerTest::SetUpTestCase()
29 {
30 }
TearDownTestCase()31 void DmAdapterManagerTest::TearDownTestCase()
32 {
33 }
34 
35 namespace {
36 std::shared_ptr<DmAdapterManager> dmAdapterManager =
37     std::make_shared<DmAdapterManager>();
38 
39 /**
40  * @tc.name: DmAdapterManager::GetCryptoAdapter_001
41  * @tc.desc: 1 set soName to null
42  *           2 callDmAdapterManager::GetCryptoAdapter_001 with soName = nullptr
43  * @tc.type: FUNC
44  * @tc.require:AR000GHSJK
45  */
46 HWTEST_F(DmAdapterManagerTest, GetCryptoAdapter_001, testing::ext::TestSize.Level0)
47 {
48     std::string soName = "123";
49     soName.clear();
50     if (dmAdapterManager == nullptr) {
51         dmAdapterManager = std::make_shared<DmAdapterManager>();
52     }
53     std::shared_ptr<ICryptoAdapter> iCryptoAdapter = dmAdapterManager->GetCryptoAdapter(soName);
54     EXPECT_EQ(nullptr, iCryptoAdapter);
55 }
56 }
57 }
58 }
59