1 /*
2  * Copyright (c) 2024-2025 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 
18 #include "notification_slot.h"
19 
20 using namespace testing::ext;
21 namespace OHOS {
22 namespace Notification {
23 class NotificationSlotTest : public testing::Test {
24 public:
SetUpTestCase()25     static void SetUpTestCase() {}
TearDownTestCase()26     static void TearDownTestCase() {}
SetUp()27     void SetUp() {}
TearDown()28     void TearDown() {}
29 };
30 
31 /**
32  * @tc.name: GetSlotTypeByString_00001
33  * @tc.desc: Test GetSlotTypeByString method is ok.
34  * @tc.type: FUNC
35  * @tc.require: issue
36  */
37 HWTEST_F(NotificationSlotTest, GetSlotTypeByString_00001, Function | SmallTest | Level1)
38 {
39     NotificationConstant::SlotType type;
40     EXPECT_EQ(NotificationSlot::GetSlotTypeByString(NotificationSlot::CONTENT_INFORMATION, type), true);
41     EXPECT_EQ(type, NotificationConstant::SlotType::CONTENT_INFORMATION);
42 }
43 
44 /**
45  * @tc.name: GetSlotTypeByString_00002
46  * @tc.desc: Test GetSlotTypeByString method is false.
47  * @tc.type: FUNC
48  * @tc.require: issue
49  */
50 HWTEST_F(NotificationSlotTest, GetSlotTypeByString_00002, Function | SmallTest | Level1)
51 {
52     NotificationConstant::SlotType type;
53     const std::string inputStr = "others";
54     EXPECT_EQ(NotificationSlot::GetSlotTypeByString(inputStr, type), false);
55 }
56 }
57 }