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 18 #define private public 19 #define protected public 20 #include "reminder_request.h" 21 #undef private 22 #undef protected 23 24 #include "ans_inner_errors.h" 25 #include "reminder_helper.h" 26 27 using namespace testing::ext; 28 namespace OHOS { 29 namespace Notification { 30 class ReminderHelperTest : public testing::Test { 31 public: SetUpTestCase()32 static void SetUpTestCase() {} TearDownTestCase()33 static void TearDownTestCase() {} SetUp()34 void SetUp() {} TearDown()35 void TearDown() {} 36 }; 37 38 /** 39 * @tc.name: PublishReminder_00001 40 * @tc.desc: Test PublishReminder parameters. 41 * @tc.type: FUNC 42 * @tc.require: issueI5WRQ2 43 */ 44 HWTEST_F(ReminderHelperTest, PublishReminder_00001, Function | SmallTest | Level1) 45 { 46 ReminderRequest reminder; 47 ReminderHelper reminderHelper; 48 ErrCode ret = reminderHelper.PublishReminder(reminder); 49 EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); 50 } 51 52 /** 53 * @tc.name: CancelReminder_00001 54 * @tc.desc: Test CancelReminder parameters. 55 * @tc.type: FUNC 56 * @tc.require: issueI5WRQ2 57 */ 58 HWTEST_F(ReminderHelperTest, CancelReminder_00001, Function | SmallTest | Level1) 59 { 60 int32_t reminderId = 10; 61 ReminderHelper reminderHelper; 62 ErrCode ret = reminderHelper.CancelReminder(reminderId); 63 EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); 64 } 65 66 /** 67 * @tc.name: CancelAllReminders_00001 68 * @tc.desc: Test CancelAllReminders parameters. 69 * @tc.type: FUNC 70 * @tc.require: issueI5WRQ2 71 */ 72 HWTEST_F(ReminderHelperTest, CancelAllReminders_00001, Function | SmallTest | Level1) 73 { 74 ReminderHelper reminderHelper; 75 ErrCode ret = reminderHelper.CancelAllReminders(); 76 EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); 77 } 78 79 /** 80 * @tc.name: GetValidReminders_00001 81 * @tc.desc: Test GetValidReminders parameters. 82 * @tc.type: FUNC 83 * @tc.require: issueI5WRQ2 84 */ 85 HWTEST_F(ReminderHelperTest, GetValidReminders_00001, Function | SmallTest | Level1) 86 { 87 std::vector<sptr<ReminderRequest>> validReminders; 88 ReminderHelper reminderHelper; 89 ErrCode ret = reminderHelper.GetValidReminders(validReminders); 90 EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); 91 } 92 93 /** 94 * @tc.name: AddNotificationSlot_00001 95 * @tc.desc: Test AddNotificationSlot parameters. 96 * @tc.type: FUNC 97 * @tc.require: issueI5WRQ2 98 */ 99 HWTEST_F(ReminderHelperTest, AddNotificationSlot_00001, Function | SmallTest | Level1) 100 { 101 NotificationSlot slot; 102 ReminderHelper reminderHelper; 103 ErrCode ret = reminderHelper.AddNotificationSlot(slot); 104 EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); 105 } 106 107 /** 108 * @tc.name: RemoveNotificationSlot_00001 109 * @tc.desc: Test RemoveNotificationSlot parameters. 110 * @tc.type: FUNC 111 * @tc.require: issueI5WRQ2 112 */ 113 HWTEST_F(ReminderHelperTest, RemoveNotificationSlot_00001, Function | SmallTest | Level1) 114 { 115 NotificationConstant::SlotType slotType = NotificationConstant::SlotType::SERVICE_REMINDER; 116 ReminderHelper reminderHelper; 117 ErrCode ret = reminderHelper.RemoveNotificationSlot(slotType); 118 EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); 119 } 120 } 121 }