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 "adaptor_file_test.h"
17
18 #include <gtest/gtest.h>
19
20 #include "adaptor_file.h"
21
22 namespace OHOS {
23 namespace UserIam {
24 namespace PinAuth {
25 using namespace testing;
26 using namespace testing::ext;
27
SetUpTestCase()28 void AdaptorFileTest::SetUpTestCase()
29 {
30 }
31
TearDownTestCase()32 void AdaptorFileTest::TearDownTestCase()
33 {
34 }
35
SetUp()36 void AdaptorFileTest::SetUp()
37 {
38 }
39
TearDown()40 void AdaptorFileTest::TearDown()
41 {
42 }
43
44 /**
45 * @tc.name: FileOperator is nullptr
46 * @tc.desc: verify IsFileOperatorValid
47 * @tc.type: FUNC
48 * @tc.require: #I64XCB
49 */
50 HWTEST_F(AdaptorFileTest, FileOperator_test0, TestSize.Level1)
51 {
52 bool result = IsFileOperatorValid(nullptr);
53 EXPECT_EQ(result, false);
54 }
55
56 /**
57 * @tc.name: FileOperator is DEFAULT_FILE_OPERATOR
58 * @tc.desc: verify GetFileOperator
59 * @tc.type: FUNC
60 * @tc.require: #I64XCB
61 */
62 HWTEST_F(AdaptorFileTest, FileOperator_test7, TestSize.Level1)
63 {
64 FileOperator *fileOp = GetFileOperator(DEFAULT_FILE_OPERATOR);
65 EXPECT_NE(fileOp, nullptr);
66 bool result = IsFileOperatorValid(fileOp);
67 EXPECT_EQ(result, true);
68 }
69 } // namespace PinAuth
70 } // namespace UserIam
71 } // namespace OHOS
72