1 /*
2 * Copyright (c) 2023 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 "hisys_event_util.h"
18 #include "print_constant.h"
19 #include "print_log.h"
20
21 #include "mock_hisys_event_util.h"
22
23 using namespace testing::ext;
24
25 namespace OHOS {
26 namespace Print {
27 class HisysEventUtilTest : public testing::Test {
28 public:
29 static void SetUpTestCase(void);
30 static void TearDownTestCase(void);
31 void SetUp();
32 void TearDown();
33 };
34
SetUpTestCase(void)35 void HisysEventUtilTest::SetUpTestCase(void) {}
36
TearDownTestCase(void)37 void HisysEventUtilTest::TearDownTestCase(void) {}
38
SetUp(void)39 void HisysEventUtilTest::SetUp(void) {}
40
TearDown(void)41 void HisysEventUtilTest::TearDown(void) {}
42
43 /**
44 * @tc.name: HisysEventUtilTest_0001
45 * @tc.desc: reportPrintSuccess
46 * @tc.type: FUNC
47 * @tc.require:
48 */
49 HWTEST_F(HisysEventUtilTest, HisysEventUtilTest_0001, TestSize.Level1)
50 {
51 OHOS::Print::HisysEventUtil util;
52 util->reportPrintSuccess("printSuccess");
53 EXPECT_CALL(util, reportBehaviorEvent(_, _, _)).Times(1);
54 }
55
56 /**
57 * @tc.name: HisysEventUtilTest_0001
58 * @tc.desc: faultPrint
59 * @tc.type: FUNC
60 * @tc.require:
61 */
62 HWTEST_F(HisysEventUtilTest, HisysEventUtilTest_0002, TestSize.Level1)
63 {
64 OHOS::Print::HisysEventUtil util;
65 util->faultPrint("printfault", "errCode");
66 EXPECT_CALL(util, reportFaultEvent(_, _, _, _)).Times(1);
67 }
68 } // namespace Print
69 } // namespace OHOS