From 8c4bd610aecfda0493c36f19c9ad1da6e12c6723 Mon Sep 17 00:00:00 2001 From: liqiang Date: Sat, 3 Dec 2022 10:08:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=9D=99=E6=80=81=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E5=8F=8A=E6=A0=BC=E5=BC=8F=E9=94=99=E8=AF=AF=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liqiang Change-Id: I13408b6836ed3ec399e93b9b73939d6d3f4b10f3 --- ...nabled_notification_callback_data_test.cpp | 304 +-- .../ans/test/unittest/message_user_test.cpp | 194 +- .../notification_bundle_option_test.cpp | 268 +-- .../unittest/notification_content_test.cpp | 254 +- ...tification_conversational_content_test.cpp | 198 +- ...tification_conversational_message_test.cpp | 326 +-- .../notification_do_not_disturb_date_test.cpp | 314 +-- .../unittest/notification_helper_test.cpp | 2108 ++++++++--------- 8 files changed, 1983 insertions(+), 1983 deletions(-) diff --git a/frameworks/ans/test/unittest/enabled_notification_callback_data_test.cpp b/frameworks/ans/test/unittest/enabled_notification_callback_data_test.cpp index d37093333..d8d1049ad 100644 --- a/frameworks/ans/test/unittest/enabled_notification_callback_data_test.cpp +++ b/frameworks/ans/test/unittest/enabled_notification_callback_data_test.cpp @@ -1,153 +1,153 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#define private public -#define protected public -#include "enabled_notification_callback_data.h" -#undef private -#undef protected - -using namespace testing::ext; -namespace OHOS { -namespace Notification { -class NotificationCallbackDataTest : public testing::Test { -public: - static void SetUpTestCase() {} - static void TearDownTestCase() {} - void SetUp() {} - void TearDown() {} -}; - -/** - * @tc.name: SetBundle_00001 - * @tc.desc: Test SetBundle parameters. - * @tc.type: FUNC - * @tc.require: issueI5W15B - */ -HWTEST_F(NotificationCallbackDataTest, SetBundle_00001, Function | SmallTest | Level1) -{ - std::string bundle = "Bundle"; - uid_t uid = 10; - bool enable = true; - auto rrc = std::make_shared(bundle, uid, enable); - rrc->SetBundle(bundle); - EXPECT_EQ(rrc->GetBundle(), bundle); -} - -/** - * @tc.name: SetUid_00001 - * @tc.desc: Test SetUid parameters. - * @tc.type: FUNC - * @tc.require: issueI5W15B - */ -HWTEST_F(NotificationCallbackDataTest, SetUid_00001, Function | SmallTest | Level1) -{ - std::string bundle = "Bundle"; - uid_t uid = 10; - bool enable = true; - auto rrc = std::make_shared(bundle, uid, enable); - rrc->SetUid(uid); - EXPECT_EQ(rrc->GetUid(), uid); -} - -/** - * @tc.name: SetEnable_00001 - * @tc.desc: Test SetEnable parameters. - * @tc.type: FUNC - * @tc.require: issueI5W15B - */ -HWTEST_F(NotificationCallbackDataTest, SetEnable_00001, Function | SmallTest | Level1) -{ - std::string bundle = "Bundle"; - uid_t uid = 10; - bool enable = true; - auto rrc = std::make_shared(bundle, uid, enable); - rrc->SetEnable(enable); - EXPECT_EQ(rrc->GetEnable(), enable); -} - -/** - * @tc.name: Dump_00001 - * @tc.desc: Test Dump parameters. - * @tc.type: FUNC - * @tc.require: issueI5W15B - */ -HWTEST_F(NotificationCallbackDataTest, Dump_00001, Function | SmallTest | Level1) -{ - std::string bundle = "Bundle"; - uid_t uid = 10; - bool enable = true; - std::string result = "EnabledNotificationCallbackData{ bundle = Bundle, uid = 10, enable = 1 }"; - auto rrc = std::make_shared(bundle, uid, enable); - EXPECT_EQ(rrc->Dump(), result); -} - -/** - * @tc.name: Marshalling_00001 - * @tc.desc: Test Marshalling parameters. - * @tc.type: FUNC - * @tc.require: issueI5W15B - */ -HWTEST_F(NotificationCallbackDataTest, Marshalling_00001, Function | SmallTest | Level1) -{ - std::string bundle = "Bundle"; - uid_t uid = 10; - bool enable = true; - Parcel parcel; - auto rrc = std::make_shared(bundle, uid, enable); - EXPECT_EQ(rrc->Marshalling(parcel), true); -} - -/** - * @tc.name: Unmarshalling_00001 - * @tc.desc: Test Unmarshalling parameters. - * @tc.type: FUNC - * @tc.require: issueI5W15B - */ -HWTEST_F(NotificationCallbackDataTest, Unmarshalling_00001, Function | SmallTest | Level1) -{ - std::string bundle = "Bundle"; - uid_t uid = 10; - bool enable = true; - bool unmarshalling = true; - Parcel parcel; - auto rrc = std::make_shared(bundle, uid, enable); - if (nullptr != rrc) { - if (nullptr == rrc->Unmarshalling(parcel)) { - unmarshalling = false; - } - } - EXPECT_EQ(unmarshalling, true); -} - -/** - * @tc.name: ReadFromParcel_00001 - * @tc.desc: Test ReadFromParcel parameters. - * @tc.type: FUNC - * @tc.require: issueI5W15B - */ -HWTEST_F(NotificationCallbackDataTest, ReadFromParcel_00001, Function | SmallTest | Level1) -{ - std::string bundle = "Bundle"; - uid_t uid = 10; - bool enable = true; - Parcel parcel; - auto rrc = std::make_shared(bundle, uid, enable); - EXPECT_EQ(rrc->ReadFromParcel(parcel), true); -} -} +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#define private public +#define protected public +#include "enabled_notification_callback_data.h" +#undef private +#undef protected + +using namespace testing::ext; +namespace OHOS { +namespace Notification { +class NotificationCallbackDataTest : public testing::Test { +public: + static void SetUpTestCase() {} + static void TearDownTestCase() {} + void SetUp() {} + void TearDown() {} +}; + +/** + * @tc.name: SetBundle_00001 + * @tc.desc: Test SetBundle parameters. + * @tc.type: FUNC + * @tc.require: issueI5W15B + */ +HWTEST_F(NotificationCallbackDataTest, SetBundle_00001, Function | SmallTest | Level1) +{ + std::string bundle = "Bundle"; + uid_t uid = 10; + bool enable = true; + auto rrc = std::make_shared(bundle, uid, enable); + rrc->SetBundle(bundle); + EXPECT_EQ(rrc->GetBundle(), bundle); +} + +/** + * @tc.name: SetUid_00001 + * @tc.desc: Test SetUid parameters. + * @tc.type: FUNC + * @tc.require: issueI5W15B + */ +HWTEST_F(NotificationCallbackDataTest, SetUid_00001, Function | SmallTest | Level1) +{ + std::string bundle = "Bundle"; + uid_t uid = 10; + bool enable = true; + auto rrc = std::make_shared(bundle, uid, enable); + rrc->SetUid(uid); + EXPECT_EQ(rrc->GetUid(), uid); +} + +/** + * @tc.name: SetEnable_00001 + * @tc.desc: Test SetEnable parameters. + * @tc.type: FUNC + * @tc.require: issueI5W15B + */ +HWTEST_F(NotificationCallbackDataTest, SetEnable_00001, Function | SmallTest | Level1) +{ + std::string bundle = "Bundle"; + uid_t uid = 10; + bool enable = true; + auto rrc = std::make_shared(bundle, uid, enable); + rrc->SetEnable(enable); + EXPECT_EQ(rrc->GetEnable(), enable); +} + +/** + * @tc.name: Dump_00001 + * @tc.desc: Test Dump parameters. + * @tc.type: FUNC + * @tc.require: issueI5W15B + */ +HWTEST_F(NotificationCallbackDataTest, Dump_00001, Function | SmallTest | Level1) +{ + std::string bundle = "Bundle"; + uid_t uid = 10; + bool enable = true; + std::string result = "EnabledNotificationCallbackData{ bundle = Bundle, uid = 10, enable = 1 }"; + auto rrc = std::make_shared(bundle, uid, enable); + EXPECT_EQ(rrc->Dump(), result); +} + +/** + * @tc.name: Marshalling_00001 + * @tc.desc: Test Marshalling parameters. + * @tc.type: FUNC + * @tc.require: issueI5W15B + */ +HWTEST_F(NotificationCallbackDataTest, Marshalling_00001, Function | SmallTest | Level1) +{ + std::string bundle = "Bundle"; + uid_t uid = 10; + bool enable = true; + Parcel parcel; + auto rrc = std::make_shared(bundle, uid, enable); + EXPECT_EQ(rrc->Marshalling(parcel), true); +} + +/** + * @tc.name: Unmarshalling_00001 + * @tc.desc: Test Unmarshalling parameters. + * @tc.type: FUNC + * @tc.require: issueI5W15B + */ +HWTEST_F(NotificationCallbackDataTest, Unmarshalling_00001, Function | SmallTest | Level1) +{ + std::string bundle = "Bundle"; + uid_t uid = 10; + bool enable = true; + bool unmarshalling = true; + Parcel parcel; + auto rrc = std::make_shared(bundle, uid, enable); + if (nullptr != rrc) { + if (nullptr == rrc->Unmarshalling(parcel)) { + unmarshalling = false; + } + } + EXPECT_EQ(unmarshalling, true); +} + +/** + * @tc.name: ReadFromParcel_00001 + * @tc.desc: Test ReadFromParcel parameters. + * @tc.type: FUNC + * @tc.require: issueI5W15B + */ +HWTEST_F(NotificationCallbackDataTest, ReadFromParcel_00001, Function | SmallTest | Level1) +{ + std::string bundle = "Bundle"; + uid_t uid = 10; + bool enable = true; + Parcel parcel; + auto rrc = std::make_shared(bundle, uid, enable); + EXPECT_EQ(rrc->ReadFromParcel(parcel), true); +} +} } \ No newline at end of file diff --git a/frameworks/ans/test/unittest/message_user_test.cpp b/frameworks/ans/test/unittest/message_user_test.cpp index 00f3658d8..6dabc11ee 100644 --- a/frameworks/ans/test/unittest/message_user_test.cpp +++ b/frameworks/ans/test/unittest/message_user_test.cpp @@ -1,98 +1,98 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#define private public -#define protected public -#include "message_user.h" -#undef private -#undef protected - -using namespace testing::ext; -namespace OHOS { -namespace Notification { -class MessageUserTest : public testing::Test { -public: - static void SetUpTestCase() {} - static void TearDownTestCase() {} - void SetUp() {} - void TearDown() {} -}; - -/** - * @tc.name: FromJson_00001 - * @tc.desc: Test FromJson parameters. - * @tc.type: FUNC - * @tc.require: issue - */ -HWTEST_F(MessageUserTest, FromJson_00001, Function | SmallTest | Level1) -{ - sptr messageUser = nullptr; - nlohmann::json jsonObject; - EXPECT_EQ(messageUser ->FromJson(jsonObject), nullptr); -} - -/** - * @tc.name: Unmarshalling_00001 - * @tc.desc: Test Unmarshalling parameters. - * @tc.type: FUNC - * @tc.require: issue - */ -HWTEST_F(MessageUserTest, Unmarshalling_001, Function | SmallTest | Level1) -{ - bool unmarshalling = true; - Parcel parcel; - std::shared_ptr result = std::make_shared(); - - if (nullptr != result) { - if (nullptr == result->Unmarshalling(parcel)) { - unmarshalling = false; - } - } - EXPECT_EQ(unmarshalling, false); -} - -/** - * @tc.name: ReadFromParcel_00001 - * @tc.desc: Test ReadFromParcel parameters. - * @tc.type: FUNC - * @tc.require: issue - */ -HWTEST_F(MessageUserTest, ReadFromParcel_00001, Function | SmallTest | Level1) -{ - MessageUser messageUser; - Parcel parcel; - - EXPECT_EQ(messageUser.ReadFromParcel(parcel), false); -} - -/** - * @tc.name: ReadFromParcel_00002 - * @tc.desc: Test ReadFromParcel parameters. - * @tc.type: FUNC - * @tc.require: issue - */ -HWTEST_F(MessageUserTest, ReadFromParcel_00002, Function | SmallTest | Level1) -{ - MessageUser messageUser; - Parcel parcel; - int32_t empty = 10; - - parcel.WriteInt32(empty); - EXPECT_EQ(messageUser.ReadFromParcel(parcel), false); -} -} +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#define private public +#define protected public +#include "message_user.h" +#undef private +#undef protected + +using namespace testing::ext; +namespace OHOS { +namespace Notification { +class MessageUserTest : public testing::Test { +public: + static void SetUpTestCase() {} + static void TearDownTestCase() {} + void SetUp() {} + void TearDown() {} +}; + +/** + * @tc.name: FromJson_00001 + * @tc.desc: Test FromJson parameters. + * @tc.type: FUNC + * @tc.require: issue + */ +HWTEST_F(MessageUserTest, FromJson_00001, Function | SmallTest | Level1) +{ + sptr messageUser = nullptr; + nlohmann::json jsonObject; + EXPECT_EQ(messageUser ->FromJson(jsonObject), nullptr); +} + +/** + * @tc.name: Unmarshalling_00001 + * @tc.desc: Test Unmarshalling parameters. + * @tc.type: FUNC + * @tc.require: issue + */ +HWTEST_F(MessageUserTest, Unmarshalling_001, Function | SmallTest | Level1) +{ + bool unmarshalling = true; + Parcel parcel; + std::shared_ptr result = std::make_shared(); + + if (nullptr != result) { + if (nullptr == result->Unmarshalling(parcel)) { + unmarshalling = false; + } + } + EXPECT_EQ(unmarshalling, false); +} + +/** + * @tc.name: ReadFromParcel_00001 + * @tc.desc: Test ReadFromParcel parameters. + * @tc.type: FUNC + * @tc.require: issue + */ +HWTEST_F(MessageUserTest, ReadFromParcel_00001, Function | SmallTest | Level1) +{ + MessageUser messageUser; + Parcel parcel; + + EXPECT_EQ(messageUser.ReadFromParcel(parcel), false); +} + +/** + * @tc.name: ReadFromParcel_00002 + * @tc.desc: Test ReadFromParcel parameters. + * @tc.type: FUNC + * @tc.require: issue + */ +HWTEST_F(MessageUserTest, ReadFromParcel_00002, Function | SmallTest | Level1) +{ + MessageUser messageUser; + Parcel parcel; + int32_t empty = 10; + + parcel.WriteInt32(empty); + EXPECT_EQ(messageUser.ReadFromParcel(parcel), false); +} +} } \ No newline at end of file diff --git a/frameworks/ans/test/unittest/notification_bundle_option_test.cpp b/frameworks/ans/test/unittest/notification_bundle_option_test.cpp index da271a3f6..7139936f3 100644 --- a/frameworks/ans/test/unittest/notification_bundle_option_test.cpp +++ b/frameworks/ans/test/unittest/notification_bundle_option_test.cpp @@ -1,135 +1,135 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#define private public -#define protected public -#include "notification_bundle_option.h" -#undef private -#undef protected - -using namespace testing::ext; -namespace OHOS { -namespace Notification { -class NotificationBundleOptionTest : public testing::Test { -public: - static void SetUpTestCase() {} - static void TearDownTestCase() {} - void SetUp() {} - void TearDown() {} -}; - -/** - * @tc.name: SetBundleName_00001 - * @tc.desc: Test SetBundleName parameters. - * @tc.type: FUNC - * @tc.require: issueI5WBBH - */ -HWTEST_F(NotificationBundleOptionTest, SetBundleName_00001, Function | SmallTest | Level1) -{ - std::string bundleName = "BundleName"; - std::string bundleName1 = "BundleName1"; - int32_t uid = 10; - auto rrc = std::make_shared(bundleName, uid); - rrc->SetBundleName(bundleName1); - EXPECT_EQ(rrc->GetBundleName(), bundleName1); -} - -/** - * @tc.name: SetUid_00001 - * @tc.desc: Test SetUid parameters. - * @tc.type: FUNC - * @tc.require: issueI5WBBH - */ -HWTEST_F(NotificationBundleOptionTest, SetUid_00001, Function | SmallTest | Level1) -{ - std::string bundleName = "BundleName"; - int32_t uid = 10; - int32_t uid1 = 20; - auto rrc = std::make_shared(bundleName, uid); - rrc->SetUid(uid1); - EXPECT_EQ(rrc->GetUid(), uid1); -} - -/** - * @tc.name: Dump_00001 - * @tc.desc: Test Dump parameters. - * @tc.type: FUNC - * @tc.require: issueI5WBBH - */ -HWTEST_F(NotificationBundleOptionTest, Dump_00001, Function | SmallTest | Level1) -{ - std::string bundleName = "BundleName"; - int32_t uid = 10; - auto rrc = std::make_shared(bundleName, uid); - std::string ret = "NotificationBundleOption{ bundleName = BundleName, uid = 10 }"; - EXPECT_EQ(rrc->Dump(), ret); -} - -/** - * @tc.name: Marshalling_00001 - * @tc.desc: Test Marshalling parameters. - * @tc.type: FUNC - * @tc.require: issueI5WBBH - */ -HWTEST_F(NotificationBundleOptionTest, Marshalling_00001, Function | SmallTest | Level1) -{ - Parcel parcel; - std::string bundleName = "BundleName"; - int32_t uid = 10; - auto rrc = std::make_shared(bundleName, uid); - EXPECT_EQ(rrc->Marshalling(parcel), true); -} - -/** - * @tc.name: Unmarshalling_00001 - * @tc.desc: Test Unmarshalling parameters. - * @tc.type: FUNC - * @tc.require: issueI5WBBH - */ -HWTEST_F(NotificationBundleOptionTest, Unmarshalling_001, Function | SmallTest | Level1) -{ - bool unmarshalling = true; - Parcel parcel; - std::string bundleName = "BundleName"; - int32_t uid = 10; - std::shared_ptr result = - std::make_shared(bundleName, uid); - - if (nullptr != result) { - if (nullptr == result->Unmarshalling(parcel)) { - unmarshalling = false; - } - } - EXPECT_EQ(unmarshalling, false); -} - -/** - * @tc.name: ReadFromParcel_00001 - * @tc.desc: Test ReadFromParcel parameters. - * @tc.type: FUNC - * @tc.require: issueI5WBBH - */ -HWTEST_F(NotificationBundleOptionTest, ReadFromParcel_00001, Function | SmallTest | Level1) -{ - Parcel parcel; - std::string bundleName = "BundleName"; - int32_t uid = 10; - auto rrc = std::make_shared(bundleName, uid); - EXPECT_EQ(rrc->ReadFromParcel(parcel), false); -} -} +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#define private public +#define protected public +#include "notification_bundle_option.h" +#undef private +#undef protected + +using namespace testing::ext; +namespace OHOS { +namespace Notification { +class NotificationBundleOptionTest : public testing::Test { +public: + static void SetUpTestCase() {} + static void TearDownTestCase() {} + void SetUp() {} + void TearDown() {} +}; + +/** + * @tc.name: SetBundleName_00001 + * @tc.desc: Test SetBundleName parameters. + * @tc.type: FUNC + * @tc.require: issueI5WBBH + */ +HWTEST_F(NotificationBundleOptionTest, SetBundleName_00001, Function | SmallTest | Level1) +{ + std::string bundleName = "BundleName"; + std::string bundleName1 = "BundleName1"; + int32_t uid = 10; + auto rrc = std::make_shared(bundleName, uid); + rrc->SetBundleName(bundleName1); + EXPECT_EQ(rrc->GetBundleName(), bundleName1); +} + +/** + * @tc.name: SetUid_00001 + * @tc.desc: Test SetUid parameters. + * @tc.type: FUNC + * @tc.require: issueI5WBBH + */ +HWTEST_F(NotificationBundleOptionTest, SetUid_00001, Function | SmallTest | Level1) +{ + std::string bundleName = "BundleName"; + int32_t uid = 10; + int32_t uid1 = 20; + auto rrc = std::make_shared(bundleName, uid); + rrc->SetUid(uid1); + EXPECT_EQ(rrc->GetUid(), uid1); +} + +/** + * @tc.name: Dump_00001 + * @tc.desc: Test Dump parameters. + * @tc.type: FUNC + * @tc.require: issueI5WBBH + */ +HWTEST_F(NotificationBundleOptionTest, Dump_00001, Function | SmallTest | Level1) +{ + std::string bundleName = "BundleName"; + int32_t uid = 10; + auto rrc = std::make_shared(bundleName, uid); + std::string ret = "NotificationBundleOption{ bundleName = BundleName, uid = 10 }"; + EXPECT_EQ(rrc->Dump(), ret); +} + +/** + * @tc.name: Marshalling_00001 + * @tc.desc: Test Marshalling parameters. + * @tc.type: FUNC + * @tc.require: issueI5WBBH + */ +HWTEST_F(NotificationBundleOptionTest, Marshalling_00001, Function | SmallTest | Level1) +{ + Parcel parcel; + std::string bundleName = "BundleName"; + int32_t uid = 10; + auto rrc = std::make_shared(bundleName, uid); + EXPECT_EQ(rrc->Marshalling(parcel), true); +} + +/** + * @tc.name: Unmarshalling_00001 + * @tc.desc: Test Unmarshalling parameters. + * @tc.type: FUNC + * @tc.require: issueI5WBBH + */ +HWTEST_F(NotificationBundleOptionTest, Unmarshalling_001, Function | SmallTest | Level1) +{ + bool unmarshalling = true; + Parcel parcel; + std::string bundleName = "BundleName"; + int32_t uid = 10; + std::shared_ptr result = + std::make_shared(bundleName, uid); + + if (nullptr != result) { + if (nullptr == result->Unmarshalling(parcel)) { + unmarshalling = false; + } + } + EXPECT_EQ(unmarshalling, false); +} + +/** + * @tc.name: ReadFromParcel_00001 + * @tc.desc: Test ReadFromParcel parameters. + * @tc.type: FUNC + * @tc.require: issueI5WBBH + */ +HWTEST_F(NotificationBundleOptionTest, ReadFromParcel_00001, Function | SmallTest | Level1) +{ + Parcel parcel; + std::string bundleName = "BundleName"; + int32_t uid = 10; + auto rrc = std::make_shared(bundleName, uid); + EXPECT_EQ(rrc->ReadFromParcel(parcel), false); +} +} } \ No newline at end of file diff --git a/frameworks/ans/test/unittest/notification_content_test.cpp b/frameworks/ans/test/unittest/notification_content_test.cpp index ce0b1afb1..348c47a61 100644 --- a/frameworks/ans/test/unittest/notification_content_test.cpp +++ b/frameworks/ans/test/unittest/notification_content_test.cpp @@ -1,127 +1,127 @@ -/* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#define private public -#define protected public -#include "notification_basic_content.h" -#include "notification_content.h" -#undef private -#undef protected - -using namespace testing::ext; -namespace OHOS { -namespace Notification { -class NotificationContentTest : public testing::Test { -public: - static void SetUpTestCase() {}; - static void TearDownTestCase() {}; - void SetUp() {}; - void TearDown() {}; -}; - -/** - * @tc.name: NotificationContentMarshalling_0100 - * @tc.desc: Marshalling - * @tc.type: FUNC - * @tc.require: issueI5S0ZS - */ -HWTEST_F(NotificationContentTest, NotificationContentMarshalling_0100, Level1) -{ - Parcel parcel; - std::shared_ptr normalContent = std::make_shared(); - EXPECT_NE(normalContent, nullptr); - NotificationContent notificationContent(normalContent); - auto result = notificationContent.Marshalling(parcel); - EXPECT_EQ(result, true); -} - -/** - * @tc.name: NotificationContentReadFromParcel_0100 - * @tc.desc: ReadFromParcel - * @tc.type: FUNC - * @tc.require: issueI5S0ZS - */ -HWTEST_F(NotificationContentTest, NotificationContentReadFromParcel_0100, Level1) -{ - Parcel parcel; - std::shared_ptr normalContent = std::make_shared(); - EXPECT_NE(normalContent, nullptr); - NotificationContent notificationContent(normalContent); - auto result = notificationContent.ReadFromParcel(parcel); - EXPECT_EQ(result, true); -} - -/** - * @tc.name: NotificationBasicContentGetAdditionalText_0100 - * @tc.desc: GetAdditionalText - * @tc.type: FUNC - * @tc.require: issueI5S0ZS - */ -HWTEST_F(NotificationContentTest, NotificationBasicContentGetAdditionalText_0100, Level1) -{ - std::string additionalText = "test"; - NotificationBasicContent notificationBasicContent; - notificationBasicContent.SetAdditionalText(additionalText); - auto result = notificationBasicContent.GetAdditionalText(); - EXPECT_EQ(result, additionalText); -} - -/** - * @tc.name: NotificationBasicContentGetText_0100 - * @tc.desc: GetText - * @tc.type: FUNC - * @tc.require: issueI5S0ZS - */ -HWTEST_F(NotificationContentTest, NotificationBasicContentGetText_0100, Level1) -{ - std::string Text = "test"; - NotificationBasicContent notificationBasicContent; - notificationBasicContent.SetText(Text); - auto result = notificationBasicContent.GetText(); - EXPECT_EQ(result, Text); -} - -/** - * @tc.name: NotificationBasicContentGetTitle_0100 - * @tc.desc: GetTitle - * @tc.type: FUNC - * @tc.require: issueI5S0ZS - */ -HWTEST_F(NotificationContentTest, NotificationBasicContentGetTitle_0100, Level1) -{ - std::string title = "titleTest"; - NotificationBasicContent notificationBasicContent; - notificationBasicContent.SetTitle(title); - auto result = notificationBasicContent.GetTitle(); - EXPECT_EQ(result, title); -} - -/** - * @tc.name: NotificationBasicContentMarshalling_0100 - * @tc.desc: Marshalling - * @tc.type: FUNC - * @tc.require: issueI5S0ZS - */ -HWTEST_F(NotificationContentTest, NotificationBasicContentMarshalling_0100, Level1) -{ - Parcel parcel; - NotificationBasicContent notificationBasicContent; - auto result = notificationBasicContent.Marshalling(parcel); - EXPECT_EQ(result, true); -} -} -} +/* + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#define private public +#define protected public +#include "notification_basic_content.h" +#include "notification_content.h" +#undef private +#undef protected + +using namespace testing::ext; +namespace OHOS { +namespace Notification { +class NotificationContentTest : public testing::Test { +public: + static void SetUpTestCase() {}; + static void TearDownTestCase() {}; + void SetUp() {}; + void TearDown() {}; +}; + +/** + * @tc.name: NotificationContentMarshalling_0100 + * @tc.desc: Marshalling + * @tc.type: FUNC + * @tc.require: issueI5S0ZS + */ +HWTEST_F(NotificationContentTest, NotificationContentMarshalling_0100, Level1) +{ + Parcel parcel; + std::shared_ptr normalContent = std::make_shared(); + EXPECT_NE(normalContent, nullptr); + NotificationContent notificationContent(normalContent); + auto result = notificationContent.Marshalling(parcel); + EXPECT_EQ(result, true); +} + +/** + * @tc.name: NotificationContentReadFromParcel_0100 + * @tc.desc: ReadFromParcel + * @tc.type: FUNC + * @tc.require: issueI5S0ZS + */ +HWTEST_F(NotificationContentTest, NotificationContentReadFromParcel_0100, Level1) +{ + Parcel parcel; + std::shared_ptr normalContent = std::make_shared(); + EXPECT_NE(normalContent, nullptr); + NotificationContent notificationContent(normalContent); + auto result = notificationContent.ReadFromParcel(parcel); + EXPECT_EQ(result, true); +} + +/** + * @tc.name: NotificationBasicContentGetAdditionalText_0100 + * @tc.desc: GetAdditionalText + * @tc.type: FUNC + * @tc.require: issueI5S0ZS + */ +HWTEST_F(NotificationContentTest, NotificationBasicContentGetAdditionalText_0100, Level1) +{ + std::string additionalText = "test"; + NotificationBasicContent notificationBasicContent; + notificationBasicContent.SetAdditionalText(additionalText); + auto result = notificationBasicContent.GetAdditionalText(); + EXPECT_EQ(result, additionalText); +} + +/** + * @tc.name: NotificationBasicContentGetText_0100 + * @tc.desc: GetText + * @tc.type: FUNC + * @tc.require: issueI5S0ZS + */ +HWTEST_F(NotificationContentTest, NotificationBasicContentGetText_0100, Level1) +{ + std::string Text = "test"; + NotificationBasicContent notificationBasicContent; + notificationBasicContent.SetText(Text); + auto result = notificationBasicContent.GetText(); + EXPECT_EQ(result, Text); +} + +/** + * @tc.name: NotificationBasicContentGetTitle_0100 + * @tc.desc: GetTitle + * @tc.type: FUNC + * @tc.require: issueI5S0ZS + */ +HWTEST_F(NotificationContentTest, NotificationBasicContentGetTitle_0100, Level1) +{ + std::string title = "titleTest"; + NotificationBasicContent notificationBasicContent; + notificationBasicContent.SetTitle(title); + auto result = notificationBasicContent.GetTitle(); + EXPECT_EQ(result, title); +} + +/** + * @tc.name: NotificationBasicContentMarshalling_0100 + * @tc.desc: Marshalling + * @tc.type: FUNC + * @tc.require: issueI5S0ZS + */ +HWTEST_F(NotificationContentTest, NotificationBasicContentMarshalling_0100, Level1) +{ + Parcel parcel; + NotificationBasicContent notificationBasicContent; + auto result = notificationBasicContent.Marshalling(parcel); + EXPECT_EQ(result, true); +} +} +} diff --git a/frameworks/ans/test/unittest/notification_conversational_content_test.cpp b/frameworks/ans/test/unittest/notification_conversational_content_test.cpp index 0c91fb360..31c474c3a 100644 --- a/frameworks/ans/test/unittest/notification_conversational_content_test.cpp +++ b/frameworks/ans/test/unittest/notification_conversational_content_test.cpp @@ -1,100 +1,100 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#define private public -#define protected public -#include "notification_conversational_content.h" -#undef private -#undef protected - -using namespace testing::ext; -namespace OHOS { -namespace Notification { -class NotificationConversationalContentTest : public testing::Test { -public: - static void SetUpTestCase() {} - static void TearDownTestCase() {} - void SetUp() {} - void TearDown() {} -}; - -/** - * @tc.name: ToJson_00001 - * @tc.desc: Test ToJson parameters. - * @tc.type: FUNC - * @tc.require: issue - */ -HWTEST_F(NotificationConversationalContentTest, ToJson_00001, Function | SmallTest | Level1) -{ - MessageUser messageUser; - nlohmann::json jsonObject; - auto rrc = std::make_shared(messageUser); - rrc->FromJson(jsonObject); - EXPECT_EQ(rrc->ToJson(jsonObject), true); -} - -/** - * @tc.name: Marshalling_00001 - * @tc.desc: Test Marshalling parameters. - * @tc.type: FUNC - * @tc.require: issue - */ -HWTEST_F(NotificationConversationalContentTest, Marshalling_00001, Function | SmallTest | Level1) -{ - MessageUser messageUser; - Parcel parcel; - auto rrc = std::make_shared(messageUser); - EXPECT_EQ(rrc->Marshalling(parcel), true); -} - -/** - * @tc.name: Unmarshalling_00001 - * @tc.desc: Test Unmarshalling parameters. - * @tc.type: FUNC - * @tc.require: issue - */ -HWTEST_F(NotificationConversationalContentTest, Unmarshalling_001, Function | SmallTest | Level1) -{ - MessageUser messageUser; - bool unmarshalling = true; - Parcel parcel; - std::shared_ptr result = - std::make_shared(messageUser); - - if (nullptr != result) { - if (nullptr == result->Unmarshalling(parcel)) { - unmarshalling = false; - } - } - EXPECT_EQ(unmarshalling, false); -} - -/** - * @tc.name: ReadFromParcel_00001 - * @tc.desc: Test ReadFromParcel parameters. - * @tc.type: FUNC - * @tc.require: issue - */ -HWTEST_F(NotificationConversationalContentTest, ReadFromParcel_00001, Function | SmallTest | Level1) -{ - MessageUser messageUser; - Parcel parcel; - auto rrc = std::make_shared(messageUser); - EXPECT_EQ(rrc->ReadFromParcel(parcel), false); -} -} +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#define private public +#define protected public +#include "notification_conversational_content.h" +#undef private +#undef protected + +using namespace testing::ext; +namespace OHOS { +namespace Notification { +class NotificationConversationalContentTest : public testing::Test { +public: + static void SetUpTestCase() {} + static void TearDownTestCase() {} + void SetUp() {} + void TearDown() {} +}; + +/** + * @tc.name: ToJson_00001 + * @tc.desc: Test ToJson parameters. + * @tc.type: FUNC + * @tc.require: issue + */ +HWTEST_F(NotificationConversationalContentTest, ToJson_00001, Function | SmallTest | Level1) +{ + MessageUser messageUser; + nlohmann::json jsonObject; + auto rrc = std::make_shared(messageUser); + rrc->FromJson(jsonObject); + EXPECT_EQ(rrc->ToJson(jsonObject), true); +} + +/** + * @tc.name: Marshalling_00001 + * @tc.desc: Test Marshalling parameters. + * @tc.type: FUNC + * @tc.require: issue + */ +HWTEST_F(NotificationConversationalContentTest, Marshalling_00001, Function | SmallTest | Level1) +{ + MessageUser messageUser; + Parcel parcel; + auto rrc = std::make_shared(messageUser); + EXPECT_EQ(rrc->Marshalling(parcel), true); +} + +/** + * @tc.name: Unmarshalling_00001 + * @tc.desc: Test Unmarshalling parameters. + * @tc.type: FUNC + * @tc.require: issue + */ +HWTEST_F(NotificationConversationalContentTest, Unmarshalling_001, Function | SmallTest | Level1) +{ + MessageUser messageUser; + bool unmarshalling = true; + Parcel parcel; + std::shared_ptr result = + std::make_shared(messageUser); + + if (nullptr != result) { + if (nullptr == result->Unmarshalling(parcel)) { + unmarshalling = false; + } + } + EXPECT_EQ(unmarshalling, false); +} + +/** + * @tc.name: ReadFromParcel_00001 + * @tc.desc: Test ReadFromParcel parameters. + * @tc.type: FUNC + * @tc.require: issue + */ +HWTEST_F(NotificationConversationalContentTest, ReadFromParcel_00001, Function | SmallTest | Level1) +{ + MessageUser messageUser; + Parcel parcel; + auto rrc = std::make_shared(messageUser); + EXPECT_EQ(rrc->ReadFromParcel(parcel), false); +} +} } \ No newline at end of file diff --git a/frameworks/ans/test/unittest/notification_conversational_message_test.cpp b/frameworks/ans/test/unittest/notification_conversational_message_test.cpp index 435418b7e..3bb7bdc27 100644 --- a/frameworks/ans/test/unittest/notification_conversational_message_test.cpp +++ b/frameworks/ans/test/unittest/notification_conversational_message_test.cpp @@ -1,164 +1,164 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#define private public -#define protected public -#include "notification_conversational_message.h" -#undef private -#undef protected - -using namespace testing::ext; -namespace OHOS { -namespace Notification { -class NotificationConversationalMessageTest : public testing::Test { -public: - static void SetUpTestCase() {} - static void TearDownTestCase() {} - void SetUp() {} - void TearDown() {} -}; - -/** - * @tc.name: GetText_00001 - * @tc.desc: Test GetText parameters. - * @tc.type: FUNC - * @tc.require: issueI5W15B - */ -HWTEST_F(NotificationConversationalMessageTest, GetText_00001, Function | SmallTest | Level1) -{ - std::string text = "Text"; - int64_t timestamp = 10; - MessageUser sender; - auto rrc = std::make_shared(text, timestamp, sender); - rrc->GetSender(); - EXPECT_EQ(rrc->GetText(), text); - EXPECT_EQ(rrc->GetArrivedTime(), timestamp); -} - -/** - * @tc.name: SetData_00001 - * @tc.desc: Test SetData parameters. - * @tc.type: FUNC - * @tc.require: issueI5W15B - */ -HWTEST_F(NotificationConversationalMessageTest, SetData_00001, Function | SmallTest | Level1) -{ - std::string text = "Text"; - int64_t timestamp = 10; - MessageUser sender; - std::string mimeType = "MimeType"; - std::string uri; - std::shared_ptr uriPtr = std::make_shared(uri); - auto rrc = std::make_shared(text, timestamp, sender); - rrc->SetData(mimeType, uriPtr); - EXPECT_EQ(rrc->GetMimeType(), mimeType); - EXPECT_EQ(rrc->GetUri(), uriPtr); -} - -/** - * @tc.name: Dump_00001 - * @tc.desc: Test Dump parameters. - * @tc.type: FUNC - * @tc.require: issueI5W15B - */ -HWTEST_F(NotificationConversationalMessageTest, Dump_00001, Function | SmallTest | Level1) -{ - std::string text = "Text"; - int64_t timestamp = 10; - MessageUser sender; - auto rrc = std::make_shared(text, timestamp, sender); - std::string ret = - "NotificationConversationalMessage{ text = Text, arrivedTime = 10, mimeType = , uri = null, " - "sender = MessageUser{ key = , name = , pixelMap = null, uri = , isMachine = false, isUserImportant = false } }"; - - EXPECT_EQ(rrc->Dump(), ret); -} - -/** - * @tc.name: ToJson_00001 - * @tc.desc: Test ToJson parameters. - * @tc.type: FUNC - * @tc.require: issueI5W15B - */ -HWTEST_F(NotificationConversationalMessageTest, ToJson_00001, Function | SmallTest | Level1) -{ - std::string text = "Text"; - int64_t timestamp = 10; - MessageUser sender; - nlohmann::json jsonObject; - auto rrc = std::make_shared(text, timestamp, sender); - rrc->FromJson(jsonObject); - EXPECT_EQ(rrc->ToJson(jsonObject), true); -} - -/** - * @tc.name: Marshalling_00001 - * @tc.desc: Test Marshalling parameters. - * @tc.type: FUNC - * @tc.require: issueI5W15B - */ -HWTEST_F(NotificationConversationalMessageTest, Marshalling_00001, Function | SmallTest | Level1) -{ - std::string text = "Text"; - int64_t timestamp = 10; - MessageUser sender; - Parcel parcel; - auto rrc = std::make_shared(text, timestamp, sender); - EXPECT_EQ(rrc->Marshalling(parcel), true); -} - -/** - * @tc.name: Unmarshalling_00001 - * @tc.desc: Test Unmarshalling parameters. - * @tc.type: FUNC - * @tc.require: issueI5W15B - */ -HWTEST_F(NotificationConversationalMessageTest, Unmarshalling_001, Function | SmallTest | Level1) -{ - std::string text = "Text"; - int64_t timestamp = 10; - MessageUser sender; - bool unmarshalling = true; - Parcel parcel; - std::shared_ptr result = - std::make_shared(text, timestamp, sender); - - if (nullptr != result) { - if (nullptr == result->Unmarshalling(parcel)) { - unmarshalling = false; - } - } - EXPECT_EQ(unmarshalling, false); -} - -/** - * @tc.name: ReadFromParcel_00001 - * @tc.desc: Test ReadFromParcel parameters. - * @tc.type: FUNC - * @tc.require: issueI5W15B - */ -HWTEST_F(NotificationConversationalMessageTest, ReadFromParcel_00001, Function | SmallTest | Level1) -{ - std::string text = "Text"; - int64_t timestamp = 10; - MessageUser sender; - Parcel parcel; - auto rrc = std::make_shared(text, timestamp, sender); - EXPECT_EQ(rrc->ReadFromParcel(parcel), false); -} -} +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#define private public +#define protected public +#include "notification_conversational_message.h" +#undef private +#undef protected + +using namespace testing::ext; +namespace OHOS { +namespace Notification { +class NotificationConversationalMessageTest : public testing::Test { +public: + static void SetUpTestCase() {} + static void TearDownTestCase() {} + void SetUp() {} + void TearDown() {} +}; + +/** + * @tc.name: GetText_00001 + * @tc.desc: Test GetText parameters. + * @tc.type: FUNC + * @tc.require: issueI5W15B + */ +HWTEST_F(NotificationConversationalMessageTest, GetText_00001, Function | SmallTest | Level1) +{ + std::string text = "Text"; + int64_t timestamp = 10; + MessageUser sender; + auto rrc = std::make_shared(text, timestamp, sender); + rrc->GetSender(); + EXPECT_EQ(rrc->GetText(), text); + EXPECT_EQ(rrc->GetArrivedTime(), timestamp); +} + +/** + * @tc.name: SetData_00001 + * @tc.desc: Test SetData parameters. + * @tc.type: FUNC + * @tc.require: issueI5W15B + */ +HWTEST_F(NotificationConversationalMessageTest, SetData_00001, Function | SmallTest | Level1) +{ + std::string text = "Text"; + int64_t timestamp = 10; + MessageUser sender; + std::string mimeType = "MimeType"; + std::string uri; + std::shared_ptr uriPtr = std::make_shared(uri); + auto rrc = std::make_shared(text, timestamp, sender); + rrc->SetData(mimeType, uriPtr); + EXPECT_EQ(rrc->GetMimeType(), mimeType); + EXPECT_EQ(rrc->GetUri(), uriPtr); +} + +/** + * @tc.name: Dump_00001 + * @tc.desc: Test Dump parameters. + * @tc.type: FUNC + * @tc.require: issueI5W15B + */ +HWTEST_F(NotificationConversationalMessageTest, Dump_00001, Function | SmallTest | Level1) +{ + std::string text = "Text"; + int64_t timestamp = 10; + MessageUser sender; + auto rrc = std::make_shared(text, timestamp, sender); + std::string ret = + "NotificationConversationalMessage{ text = Text, arrivedTime = 10, mimeType = , uri = null, " + "sender = MessageUser{ key = , name = , pixelMap = null, uri = , isMachine = false, isUserImportant = false } }"; + + EXPECT_EQ(rrc->Dump(), ret); +} + +/** + * @tc.name: ToJson_00001 + * @tc.desc: Test ToJson parameters. + * @tc.type: FUNC + * @tc.require: issueI5W15B + */ +HWTEST_F(NotificationConversationalMessageTest, ToJson_00001, Function | SmallTest | Level1) +{ + std::string text = "Text"; + int64_t timestamp = 10; + MessageUser sender; + nlohmann::json jsonObject; + auto rrc = std::make_shared(text, timestamp, sender); + rrc->FromJson(jsonObject); + EXPECT_EQ(rrc->ToJson(jsonObject), true); +} + +/** + * @tc.name: Marshalling_00001 + * @tc.desc: Test Marshalling parameters. + * @tc.type: FUNC + * @tc.require: issueI5W15B + */ +HWTEST_F(NotificationConversationalMessageTest, Marshalling_00001, Function | SmallTest | Level1) +{ + std::string text = "Text"; + int64_t timestamp = 10; + MessageUser sender; + Parcel parcel; + auto rrc = std::make_shared(text, timestamp, sender); + EXPECT_EQ(rrc->Marshalling(parcel), true); +} + +/** + * @tc.name: Unmarshalling_00001 + * @tc.desc: Test Unmarshalling parameters. + * @tc.type: FUNC + * @tc.require: issueI5W15B + */ +HWTEST_F(NotificationConversationalMessageTest, Unmarshalling_001, Function | SmallTest | Level1) +{ + std::string text = "Text"; + int64_t timestamp = 10; + MessageUser sender; + bool unmarshalling = true; + Parcel parcel; + std::shared_ptr result = + std::make_shared(text, timestamp, sender); + + if (nullptr != result) { + if (nullptr == result->Unmarshalling(parcel)) { + unmarshalling = false; + } + } + EXPECT_EQ(unmarshalling, false); +} + +/** + * @tc.name: ReadFromParcel_00001 + * @tc.desc: Test ReadFromParcel parameters. + * @tc.type: FUNC + * @tc.require: issueI5W15B + */ +HWTEST_F(NotificationConversationalMessageTest, ReadFromParcel_00001, Function | SmallTest | Level1) +{ + std::string text = "Text"; + int64_t timestamp = 10; + MessageUser sender; + Parcel parcel; + auto rrc = std::make_shared(text, timestamp, sender); + EXPECT_EQ(rrc->ReadFromParcel(parcel), false); +} +} } \ No newline at end of file diff --git a/frameworks/ans/test/unittest/notification_do_not_disturb_date_test.cpp b/frameworks/ans/test/unittest/notification_do_not_disturb_date_test.cpp index c254f89eb..61998c494 100644 --- a/frameworks/ans/test/unittest/notification_do_not_disturb_date_test.cpp +++ b/frameworks/ans/test/unittest/notification_do_not_disturb_date_test.cpp @@ -1,158 +1,158 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#define private public -#define protected public -#include "notification_do_not_disturb_date.h" -#undef private -#undef protected - -#include "notification_constant.h" - -using namespace testing::ext; -namespace OHOS { -namespace Notification { -class NotificationDoNotDisturbDateTest : public testing::Test { -public: - static void SetUpTestCase() {} - static void TearDownTestCase() {} - void SetUp() {} - void TearDown() {} -}; - -/** - * @tc.name: SetDoNotDisturbType_00001 - * @tc.desc: Test SetDoNotDisturbType parameters. - * @tc.type: FUNC - * @tc.require: issueI5WBBH - */ -HWTEST_F(NotificationDoNotDisturbDateTest, SetDoNotDisturbType_00001, Function | SmallTest | Level1) -{ - NotificationConstant::DoNotDisturbType doNotDisturbType = NotificationConstant::DoNotDisturbType::ONCE; - int64_t beginDate = 10; - int64_t endDate = 10; - auto rrc = std::make_shared(doNotDisturbType, beginDate, endDate); - rrc->SetDoNotDisturbType(doNotDisturbType); - EXPECT_EQ(rrc->GetDoNotDisturbType(), doNotDisturbType); -} - -/** - * @tc.name: SetBeginDate_00001 - * @tc.desc: Test SetBeginDate parameters. - * @tc.type: FUNC - * @tc.require: issueI5WBBH - */ -HWTEST_F(NotificationDoNotDisturbDateTest, SetBeginDate_00001, Function | SmallTest | Level1) -{ - NotificationConstant::DoNotDisturbType doNotDisturbType = NotificationConstant::DoNotDisturbType::ONCE; - int64_t beginDate = 10; - int64_t beginDate1 = 20; - int64_t endDate = 10; - auto rrc = std::make_shared(doNotDisturbType, beginDate, endDate); - rrc->SetBeginDate(beginDate1); - EXPECT_EQ(rrc->GetBeginDate(), beginDate1); -} - -/** - * @tc.name: SetEndDate_00001 - * @tc.desc: Test SetEndDate parameters. - * @tc.type: FUNC - * @tc.require: issueI5WBBH - */ -HWTEST_F(NotificationDoNotDisturbDateTest, SetEndDate_00001, Function | SmallTest | Level1) -{ - NotificationConstant::DoNotDisturbType doNotDisturbType = NotificationConstant::DoNotDisturbType::ONCE; - int64_t beginDate = 10; - int64_t endDate1 = 20; - int64_t endDate = 10; - auto rrc = std::make_shared(doNotDisturbType, beginDate, endDate); - rrc->SetEndDate(endDate1); - EXPECT_EQ(rrc->GetEndDate(), endDate1); -} - -/** - * @tc.name: Dump_00001 - * @tc.desc: Test Dump parameters. - * @tc.type: FUNC - * @tc.require: issueI5WBBH - */ -HWTEST_F(NotificationDoNotDisturbDateTest, Dump_00001, Function | SmallTest | Level1) -{ - NotificationConstant::DoNotDisturbType doNotDisturbType = NotificationConstant::DoNotDisturbType::ONCE; - int64_t beginDate = 10; - int64_t endDate = 10; - auto rrc = std::make_shared(doNotDisturbType, beginDate, endDate); - std::string ret = "NotificationDoNotDisturbDate{ doNotDisturbType = 1, beginDate = 10, endDate = 10 }"; - EXPECT_EQ(rrc->Dump(), ret); -} - -/** - * @tc.name: Marshalling_00001 - * @tc.desc: Test Marshalling parameters. - * @tc.type: FUNC - * @tc.require: issueI5WBBH - */ -HWTEST_F(NotificationDoNotDisturbDateTest, Marshalling_00001, Function | SmallTest | Level1) -{ - Parcel parcel; - NotificationConstant::DoNotDisturbType doNotDisturbType = NotificationConstant::DoNotDisturbType::ONCE; - int64_t beginDate = 10; - int64_t endDate = 10; - auto rrc = std::make_shared(doNotDisturbType, beginDate, endDate); - EXPECT_EQ(rrc->Marshalling(parcel), true); -} - -/** - * @tc.name: Unmarshalling_00001 - * @tc.desc: Test Unmarshalling parameters. - * @tc.type: FUNC - * @tc.require: issueI5WBBH - */ -HWTEST_F(NotificationDoNotDisturbDateTest, Unmarshalling_001, Function | SmallTest | Level1) -{ - bool unmarshalling = true; - Parcel parcel; - NotificationConstant::DoNotDisturbType doNotDisturbType = NotificationConstant::DoNotDisturbType::ONCE; - int64_t beginDate = 10; - int64_t endDate = 10; - std::shared_ptr result = - std::make_shared(doNotDisturbType, beginDate, endDate); - if (nullptr != result) { - if (nullptr == result->Unmarshalling(parcel)) { - unmarshalling = false; - } - } - EXPECT_EQ(unmarshalling, true); -} - -/** - * @tc.name: ReadFromParcel_00001 - * @tc.desc: Test ReadFromParcel parameters. - * @tc.type: FUNC - * @tc.require: issueI5WBBH - */ -HWTEST_F(NotificationDoNotDisturbDateTest, ReadFromParcel_00001, Function | SmallTest | Level1) -{ - Parcel parcel; - NotificationConstant::DoNotDisturbType doNotDisturbType = NotificationConstant::DoNotDisturbType::ONCE; - int64_t beginDate = 10; - int64_t endDate = 10; - auto rrc = std::make_shared(doNotDisturbType, beginDate, endDate); - EXPECT_EQ(rrc->ReadFromParcel(parcel), true); -} -} +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#define private public +#define protected public +#include "notification_do_not_disturb_date.h" +#undef private +#undef protected + +#include "notification_constant.h" + +using namespace testing::ext; +namespace OHOS { +namespace Notification { +class NotificationDoNotDisturbDateTest : public testing::Test { +public: + static void SetUpTestCase() {} + static void TearDownTestCase() {} + void SetUp() {} + void TearDown() {} +}; + +/** + * @tc.name: SetDoNotDisturbType_00001 + * @tc.desc: Test SetDoNotDisturbType parameters. + * @tc.type: FUNC + * @tc.require: issueI5WBBH + */ +HWTEST_F(NotificationDoNotDisturbDateTest, SetDoNotDisturbType_00001, Function | SmallTest | Level1) +{ + NotificationConstant::DoNotDisturbType doNotDisturbType = NotificationConstant::DoNotDisturbType::ONCE; + int64_t beginDate = 10; + int64_t endDate = 10; + auto rrc = std::make_shared(doNotDisturbType, beginDate, endDate); + rrc->SetDoNotDisturbType(doNotDisturbType); + EXPECT_EQ(rrc->GetDoNotDisturbType(), doNotDisturbType); +} + +/** + * @tc.name: SetBeginDate_00001 + * @tc.desc: Test SetBeginDate parameters. + * @tc.type: FUNC + * @tc.require: issueI5WBBH + */ +HWTEST_F(NotificationDoNotDisturbDateTest, SetBeginDate_00001, Function | SmallTest | Level1) +{ + NotificationConstant::DoNotDisturbType doNotDisturbType = NotificationConstant::DoNotDisturbType::ONCE; + int64_t beginDate = 10; + int64_t beginDate1 = 20; + int64_t endDate = 10; + auto rrc = std::make_shared(doNotDisturbType, beginDate, endDate); + rrc->SetBeginDate(beginDate1); + EXPECT_EQ(rrc->GetBeginDate(), beginDate1); +} + +/** + * @tc.name: SetEndDate_00001 + * @tc.desc: Test SetEndDate parameters. + * @tc.type: FUNC + * @tc.require: issueI5WBBH + */ +HWTEST_F(NotificationDoNotDisturbDateTest, SetEndDate_00001, Function | SmallTest | Level1) +{ + NotificationConstant::DoNotDisturbType doNotDisturbType = NotificationConstant::DoNotDisturbType::ONCE; + int64_t beginDate = 10; + int64_t endDate1 = 20; + int64_t endDate = 10; + auto rrc = std::make_shared(doNotDisturbType, beginDate, endDate); + rrc->SetEndDate(endDate1); + EXPECT_EQ(rrc->GetEndDate(), endDate1); +} + +/** + * @tc.name: Dump_00001 + * @tc.desc: Test Dump parameters. + * @tc.type: FUNC + * @tc.require: issueI5WBBH + */ +HWTEST_F(NotificationDoNotDisturbDateTest, Dump_00001, Function | SmallTest | Level1) +{ + NotificationConstant::DoNotDisturbType doNotDisturbType = NotificationConstant::DoNotDisturbType::ONCE; + int64_t beginDate = 10; + int64_t endDate = 10; + auto rrc = std::make_shared(doNotDisturbType, beginDate, endDate); + std::string ret = "NotificationDoNotDisturbDate{ doNotDisturbType = 1, beginDate = 10, endDate = 10 }"; + EXPECT_EQ(rrc->Dump(), ret); +} + +/** + * @tc.name: Marshalling_00001 + * @tc.desc: Test Marshalling parameters. + * @tc.type: FUNC + * @tc.require: issueI5WBBH + */ +HWTEST_F(NotificationDoNotDisturbDateTest, Marshalling_00001, Function | SmallTest | Level1) +{ + Parcel parcel; + NotificationConstant::DoNotDisturbType doNotDisturbType = NotificationConstant::DoNotDisturbType::ONCE; + int64_t beginDate = 10; + int64_t endDate = 10; + auto rrc = std::make_shared(doNotDisturbType, beginDate, endDate); + EXPECT_EQ(rrc->Marshalling(parcel), true); +} + +/** + * @tc.name: Unmarshalling_00001 + * @tc.desc: Test Unmarshalling parameters. + * @tc.type: FUNC + * @tc.require: issueI5WBBH + */ +HWTEST_F(NotificationDoNotDisturbDateTest, Unmarshalling_001, Function | SmallTest | Level1) +{ + bool unmarshalling = true; + Parcel parcel; + NotificationConstant::DoNotDisturbType doNotDisturbType = NotificationConstant::DoNotDisturbType::ONCE; + int64_t beginDate = 10; + int64_t endDate = 10; + std::shared_ptr result = + std::make_shared(doNotDisturbType, beginDate, endDate); + if (nullptr != result) { + if (nullptr == result->Unmarshalling(parcel)) { + unmarshalling = false; + } + } + EXPECT_EQ(unmarshalling, true); +} + +/** + * @tc.name: ReadFromParcel_00001 + * @tc.desc: Test ReadFromParcel parameters. + * @tc.type: FUNC + * @tc.require: issueI5WBBH + */ +HWTEST_F(NotificationDoNotDisturbDateTest, ReadFromParcel_00001, Function | SmallTest | Level1) +{ + Parcel parcel; + NotificationConstant::DoNotDisturbType doNotDisturbType = NotificationConstant::DoNotDisturbType::ONCE; + int64_t beginDate = 10; + int64_t endDate = 10; + auto rrc = std::make_shared(doNotDisturbType, beginDate, endDate); + EXPECT_EQ(rrc->ReadFromParcel(parcel), true); +} +} } \ No newline at end of file diff --git a/frameworks/ans/test/unittest/notification_helper_test.cpp b/frameworks/ans/test/unittest/notification_helper_test.cpp index 800e197e0..5a9634c77 100644 --- a/frameworks/ans/test/unittest/notification_helper_test.cpp +++ b/frameworks/ans/test/unittest/notification_helper_test.cpp @@ -1,1055 +1,1055 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#include "notification_bundle_option.h" -#include "notification_do_not_disturb_date.h" -#include "enabled_notification_callback_data.h" -#include "notification_request.h" -#include "notification_slot.h" -#include "notification_sorting_map.h" -#include "notification_subscriber.h" -#include "ans_inner_errors.h" -#include "errors.h" -#include "notification_helper.h" - -using namespace testing::ext; -namespace OHOS { -namespace Notification { -class NotificationHelperTest : public testing::Test { -public: - static void SetUpTestCase() {} - static void TearDownTestCase() {} - void SetUp() {} - void TearDown() {} -}; - -/** - * @tc.name: AddNotificationSlot_00001 - * @tc.desc: Test AddNotificationSlot parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, AddNotificationSlot_00001, Function | SmallTest | Level1) -{ - NotificationSlot slot; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.AddNotificationSlot(slot); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); -} - -/** - * @tc.name: AddSlotByType_00001 - * @tc.desc: Test AddSlotByType parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, AddSlotByType_00001, Function | SmallTest | Level1) -{ - NotificationConstant::SlotType slotType = NotificationConstant::SlotType::SERVICE_REMINDER; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.AddSlotByType(slotType); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); -} - -/** - * @tc.name: AddNotificationSlots_00001 - * @tc.desc: Test AddNotificationSlots parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, AddNotificationSlots_00001, Function | SmallTest | Level1) -{ - std::vector slots; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.AddNotificationSlots(slots); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); -} - -/** - * @tc.name: RemoveNotificationSlot_00001 - * @tc.desc: Test RemoveNotificationSlot parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, RemoveNotificationSlot_00001, Function | SmallTest | Level1) -{ - NotificationConstant::SlotType slotType = NotificationConstant::SlotType::SERVICE_REMINDER; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.RemoveNotificationSlot(slotType); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); -} - -/** - * @tc.name: RemoveAllSlots_00001 - * @tc.desc: Test RemoveAllSlots parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, RemoveAllSlots_00001, Function | SmallTest | Level1) -{ - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.RemoveAllSlots(); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); -} - -/** - * @tc.name: GetNotificationSlot_00001 - * @tc.desc: Test GetNotificationSlot parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, GetNotificationSlot_00001, Function | SmallTest | Level1) -{ - NotificationConstant::SlotType slotType = NotificationConstant::SlotType::SERVICE_REMINDER; - sptr slot = nullptr; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.GetNotificationSlot(slotType, slot); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); -} - -/** - * @tc.name: GetNotificationSlots_00001 - * @tc.desc: Test GetNotificationSlots parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, GetNotificationSlots_00001, Function | SmallTest | Level1) -{ - std::vector> slots; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.GetNotificationSlots(slots); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); -} - -/** - * @tc.name: GetNotificationSlotNumAsBundle_00001 - * @tc.desc: Test GetNotificationSlotNumAsBundle parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, GetNotificationSlotNumAsBundle_00001, Function | SmallTest | Level1) -{ - NotificationBundleOption bundleOption; - uint64_t num = 10; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.GetNotificationSlotNumAsBundle(bundleOption, num); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); -} - -/** - * @tc.name: PublishNotification_00001 - * @tc.desc: Test PublishNotification parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, PublishNotification_00001, Function | SmallTest | Level1) -{ - NotificationRequest request; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.PublishNotification(request); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); -} - -/** - * @tc.name: PublishNotification_00002 - * @tc.desc: Test PublishNotification parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, PublishNotification_00002, Function | SmallTest | Level1) -{ - NotificationRequest request; - std::string deviceId = "DeviceId"; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.PublishNotification(request, deviceId); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); -} - -/** - * @tc.name: PublishNotification_00003 - * @tc.desc: Test PublishNotification parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, PublishNotification_00003, Function | SmallTest | Level1) -{ - std::string label = "Label"; - NotificationRequest request; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.PublishNotification(label, request); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); -} - -/** - * @tc.name: CancelNotification_00001 - * @tc.desc: Test CancelNotification parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, CancelNotification_00001, Function | SmallTest | Level1) -{ - int32_t notificationId = 10; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.CancelNotification(notificationId); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); -} - -/** - * @tc.name: CancelNotification_00002 - * @tc.desc: Test CancelNotification parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, CancelNotification_00002, Function | SmallTest | Level1) -{ - std::string label = "Label"; - int32_t notificationId = 10; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.CancelNotification(label, notificationId); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); -} - -/** - * @tc.name: CancelAllNotifications_00001 - * @tc.desc: Test CancelAllNotifications parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, CancelAllNotifications_00001, Function | SmallTest | Level1) -{ - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.CancelAllNotifications(); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); -} - -/** - * @tc.name: CancelAsBundle_00001 - * @tc.desc: Test CancelAsBundle parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, CancelAsBundle_00001, Function | SmallTest | Level1) -{ - int32_t notificationId = 10; - std::string representativeBundle = "RepresentativeBundle"; - int32_t userId = 10; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.CancelAsBundle(notificationId, representativeBundle, userId); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_UID); -} - -/** - * @tc.name: GetActiveNotificationNums_00001 - * @tc.desc: Test GetActiveNotificationNums parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, GetActiveNotificationNums_00001, Function | SmallTest | Level1) -{ - uint64_t num = 10; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.GetActiveNotificationNums(num); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); -} - -/** - * @tc.name: GetActiveNotifications_00001 - * @tc.desc: Test GetActiveNotifications parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, GetActiveNotifications_00001, Function | SmallTest | Level1) -{ - std::vector> request; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.GetActiveNotifications(request); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); -} - -/** - * @tc.name: GetCurrentAppSorting_00001 - * @tc.desc: Test GetCurrentAppSorting parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, GetCurrentAppSorting_00001, Function | SmallTest | Level1) -{ - sptr sortingMap = nullptr; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.GetCurrentAppSorting(sortingMap); - EXPECT_EQ(ret, (int)ERR_ANS_PARCELABLE_FAILED); -} - -/** - * @tc.name: SetNotificationAgent_00001 - * @tc.desc: Test SetNotificationAgent parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, SetNotificationAgent_00001, Function | SmallTest | Level1) -{ - std::string agent = "Agent"; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.SetNotificationAgent(agent); - EXPECT_EQ(ret, (int)ERR_INVALID_OPERATION); -} - -/** - * @tc.name: GetNotificationAgent_00001 - * @tc.desc: Test GetNotificationAgent parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, GetNotificationAgent_00001, Function | SmallTest | Level1) -{ - std::string agent = "Agent"; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.GetNotificationAgent(agent); - EXPECT_EQ(ret, (int)ERR_INVALID_OPERATION); -} - -/** - * @tc.name: CanPublishNotificationAsBundle_00001 - * @tc.desc: Test CanPublishNotificationAsBundle parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, CanPublishNotificationAsBundle_00001, Function | SmallTest | Level1) -{ - std::string representativeBundle = "RepresentativeBundle"; - bool canPublish = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.CanPublishNotificationAsBundle(representativeBundle, canPublish); - EXPECT_EQ(ret, (int)ERR_INVALID_OPERATION); -} - -/** - * @tc.name: PublishNotificationAsBundle_00001 - * @tc.desc: Test PublishNotificationAsBundle parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, PublishNotificationAsBundle_00001, Function | SmallTest | Level1) -{ - std::string representativeBundle = "RepresentativeBundle"; - NotificationRequest request; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.PublishNotificationAsBundle(representativeBundle, request); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); -} - -/** - * @tc.name: SetNotificationBadgeNum_00001 - * @tc.desc: Test SetNotificationBadgeNum parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, SetNotificationBadgeNum_00001, Function | SmallTest | Level1) -{ - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.SetNotificationBadgeNum(); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); -} - -/** - * @tc.name: SetNotificationBadgeNum_00002 - * @tc.desc: Test SetNotificationBadgeNum parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, SetNotificationBadgeNum_00002, Function | SmallTest | Level1) -{ - int32_t num = 10; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.SetNotificationBadgeNum(num); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); -} - -/** - * @tc.name: IsAllowedNotify_00001 - * @tc.desc: Test IsAllowedNotify parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, IsAllowedNotify_00001, Function | SmallTest | Level1) -{ - bool allowed = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.IsAllowedNotify(allowed); - EXPECT_EQ(ret, (int)ERR_OK); -} - -/** - * @tc.name: IsAllowedNotifySelf_00001 - * @tc.desc: Test IsAllowedNotifySelf parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, IsAllowedNotifySelf_00001, Function | SmallTest | Level1) -{ - bool allowed = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.IsAllowedNotifySelf(allowed); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); -} - -/** - * @tc.name: RequestEnableNotification_00001 - * @tc.desc: Test RequestEnableNotification parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, RequestEnableNotification_00001, Function | SmallTest | Level1) -{ - std::string deviceId = "DeviceId"; - NotificationHelper notificationHelper; - bool needPop = true; - ErrCode ret = notificationHelper.RequestEnableNotification(deviceId, needPop); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); -} - -/** - * @tc.name: AreNotificationsSuspended_00001 - * @tc.desc: Test AreNotificationsSuspended parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, AreNotificationsSuspended_00001, Function | SmallTest | Level1) -{ - bool suspended = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.AreNotificationsSuspended(suspended); - EXPECT_EQ(ret, (int)ERR_INVALID_OPERATION); -} - -/** - * @tc.name: HasNotificationPolicyAccessPermission_00001 - * @tc.desc: Test HasNotificationPolicyAccessPermission parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, HasNotificationPolicyAccessPermission_00001, Function | SmallTest | Level1) -{ - bool hasPermission = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.HasNotificationPolicyAccessPermission(hasPermission); - EXPECT_EQ(ret, (int)ERR_OK); -} - -/** - * @tc.name: GetBundleImportance_00001 - * @tc.desc: Test GetBundleImportance parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, GetBundleImportance_00001, Function | SmallTest | Level1) -{ - NotificationSlot::NotificationLevel importance = NotificationSlot::NotificationLevel::LEVEL_NONE; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.GetBundleImportance(importance); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); -} - -/** - * @tc.name: RemoveNotification_00001 - * @tc.desc: Test RemoveNotification parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, RemoveNotification_00001, Function | SmallTest | Level1) -{ - std::string key = "Key"; - int32_t removeReason = 2; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.RemoveNotification(key, removeReason); - EXPECT_EQ(ret, (int)ERR_ANS_NOTIFICATION_NOT_EXISTS); -} - -/** - * @tc.name: RemoveNotification_00002 - * @tc.desc: Test RemoveNotification parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, RemoveNotification_00002, Function | SmallTest | Level1) -{ - NotificationBundleOption bundleOption; - int32_t notificationId = 10; - std::string label = "Label"; - int32_t removeReason = 2; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.RemoveNotification(bundleOption, notificationId, label, removeReason); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); -} - -/** - * @tc.name: RemoveAllNotifications_00001 - * @tc.desc: Test RemoveAllNotifications parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, RemoveAllNotifications_00001, Function | SmallTest | Level1) -{ - NotificationBundleOption bundleOption; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.RemoveAllNotifications(bundleOption); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); -} - -/** - * @tc.name: RemoveNotificationsByBundle_00001 - * @tc.desc: Test RemoveNotificationsByBundle parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, RemoveNotificationsByBundle_00001, Function | SmallTest | Level1) -{ - NotificationBundleOption bundleOption; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.RemoveNotificationsByBundle(bundleOption); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); -} - -/** - * @tc.name: RemoveNotifications_00001 - * @tc.desc: Test RemoveNotifications parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, RemoveNotifications_00001, Function | SmallTest | Level1) -{ - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.RemoveNotifications(); - EXPECT_EQ(ret, (int)ERR_OK); -} - -/** - * @tc.name: GetNotificationSlotsForBundle_00001 - * @tc.desc: Test GetNotificationSlotsForBundle parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, GetNotificationSlotsForBundle_00001, Function | SmallTest | Level1) -{ - NotificationBundleOption bundleOption; - std::vector> slots; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.GetNotificationSlotsForBundle(bundleOption, slots); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); -} - -/** - * @tc.name: UpdateNotificationSlots_00001 - * @tc.desc: Test UpdateNotificationSlots parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, UpdateNotificationSlots_00001, Function | SmallTest | Level1) -{ - NotificationBundleOption bundleOption; - std::vector> slots; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.UpdateNotificationSlots(bundleOption, slots); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); -} - -/** - * @tc.name: GetAllActiveNotifications_00001 - * @tc.desc: Test GetAllActiveNotifications parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, GetAllActiveNotifications_00001, Function | SmallTest | Level1) -{ - std::vector> notification; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.GetAllActiveNotifications(notification); - EXPECT_EQ(ret, (int)ERR_OK); -} - -/** - * @tc.name: GetAllActiveNotifications_00002 - * @tc.desc: Test GetAllActiveNotifications parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, GetAllActiveNotifications_00002, Function | SmallTest | Level1) -{ - std::vector key; - std::vector> notification; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.GetAllActiveNotifications(key, notification); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); -} - -/** - * @tc.name: IsAllowedNotify_00002 - * @tc.desc: Test IsAllowedNotify parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, IsAllowedNotify_00002, Function | SmallTest | Level1) -{ - NotificationBundleOption bundleOption; - bool allowed = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.IsAllowedNotify(bundleOption, allowed); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); -} - -/** - * @tc.name: SetNotificationsEnabledForAllBundles_00001 - * @tc.desc: Test SetNotificationsEnabledForAllBundles parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, SetNotificationsEnabledForAllBundles_00001, Function | SmallTest | Level1) -{ - std::string deviceId = "DeviceId"; - bool enabled = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.SetNotificationsEnabledForAllBundles(deviceId, enabled); - EXPECT_EQ(ret, (int)ERR_OK); -} - -/** - * @tc.name: SetNotificationsEnabledForDefaultBundle_00001 - * @tc.desc: Test SetNotificationsEnabledForDefaultBundle parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, SetNotificationsEnabledForDefaultBundle_00001, Function | SmallTest | Level1) -{ - std::string deviceId = "DeviceId"; - bool enabled = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.SetNotificationsEnabledForDefaultBundle(deviceId, enabled); - EXPECT_EQ(ret, (int)ERR_INVALID_OPERATION); -} - -/** - * @tc.name: SetShowBadgeEnabledForBundle_00001 - * @tc.desc: Test SetShowBadgeEnabledForBundle parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, SetShowBadgeEnabledForBundle_00001, Function | SmallTest | Level1) -{ - NotificationBundleOption bundleOption; - bool enabled = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.SetShowBadgeEnabledForBundle(bundleOption, enabled); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); -} - -/** - * @tc.name: GetShowBadgeEnabledForBundle_00001 - * @tc.desc: Test GetShowBadgeEnabledForBundle parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, GetShowBadgeEnabledForBundle_00001, Function | SmallTest | Level1) -{ - NotificationBundleOption bundleOption; - bool enabled = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.GetShowBadgeEnabledForBundle(bundleOption, enabled); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); -} - -/** - * @tc.name: GetShowBadgeEnabled_00001 - * @tc.desc: Test GetShowBadgeEnabled parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, GetShowBadgeEnabled_00001, Function | SmallTest | Level1) -{ - bool enabled = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.GetShowBadgeEnabled(enabled); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); -} - -/** - * @tc.name: CancelGroup_00001 - * @tc.desc: Test CancelGroup parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, CancelGroup_00001, Function | SmallTest | Level1) -{ - std::string groupName = "GroupName"; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.CancelGroup(groupName); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); -} - -/** - * @tc.name: RemoveGroupByBundle_00001 - * @tc.desc: Test RemoveGroupByBundle parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, RemoveGroupByBundle_00001, Function | SmallTest | Level1) -{ - NotificationBundleOption bundleOption; - std::string groupName = "GroupName"; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.RemoveGroupByBundle(bundleOption, groupName); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); -} - -/** - * @tc.name: SetDoNotDisturbDate_00001 - * @tc.desc: Test SetDoNotDisturbDate parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, SetDoNotDisturbDate_00001, Function | SmallTest | Level1) -{ - NotificationDoNotDisturbDate doNotDisturbDate; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.SetDoNotDisturbDate(doNotDisturbDate); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); -} - -/** - * @tc.name: GetDoNotDisturbDate_00001 - * @tc.desc: Test GetDoNotDisturbDate parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, GetDoNotDisturbDate_00001, Function | SmallTest | Level1) -{ - NotificationDoNotDisturbDate doNotDisturbDate; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.GetDoNotDisturbDate(doNotDisturbDate); - EXPECT_EQ(ret, (int)ERR_OK); -} - -/** - * @tc.name: DoesSupportDoNotDisturbMode_00001 - * @tc.desc: Test DoesSupportDoNotDisturbMode parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, DoesSupportDoNotDisturbMode_00001, Function | SmallTest | Level1) -{ - bool doesSupport = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.DoesSupportDoNotDisturbMode(doesSupport); - EXPECT_EQ(ret, (int)ERR_OK); -} - -/** - * @tc.name: IsDistributedEnabled_00001 - * @tc.desc: Test IsDistributedEnabled parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, IsDistributedEnabled_00001, Function | SmallTest | Level1) -{ - bool enabled = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.IsDistributedEnabled(enabled); - EXPECT_EQ(ret, (int)ERR_OK); -} - -/** - * @tc.name: EnableDistributed_00001 - * @tc.desc: Test EnableDistributed parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, EnableDistributed_00001, Function | SmallTest | Level1) -{ - bool enabled = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.EnableDistributed(enabled); - EXPECT_EQ(ret, (int)ERR_OK); -} - -/** - * @tc.name: EnableDistributedByBundle_00001 - * @tc.desc: Test EnableDistributedByBundle parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, EnableDistributedByBundle_00001, Function | SmallTest | Level1) -{ - NotificationBundleOption bundleOption; - bool enabled = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.EnableDistributedByBundle(bundleOption, enabled); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); -} - -/** - * @tc.name: EnableDistributedSelf_00001 - * @tc.desc: Test EnableDistributedSelf parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, EnableDistributedSelf_00001, Function | SmallTest | Level1) -{ - bool enabled = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.EnableDistributedSelf(enabled); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); -} - -/** - * @tc.name: IsDistributedEnableByBundle_00001 - * @tc.desc: Test IsDistributedEnableByBundle parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, IsDistributedEnableByBundle_00001, Function | SmallTest | Level1) -{ - NotificationBundleOption bundleOption; - bool enabled = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.IsDistributedEnableByBundle(bundleOption, enabled); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); -} - -/** - * @tc.name: GetDeviceRemindType_00001 - * @tc.desc: Test GetDeviceRemindType parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, GetDeviceRemindType_00001, Function | SmallTest | Level1) -{ - NotificationConstant::RemindType remindType = NotificationConstant::RemindType::DEVICE_ACTIVE_REMIND; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.GetDeviceRemindType(remindType); - EXPECT_EQ(ret, (int)ERR_OK); -} - -/** - * @tc.name: PublishContinuousTaskNotification_00001 - * @tc.desc: Test PublishContinuousTaskNotification parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, PublishContinuousTaskNotification_00001, Function | SmallTest | Level1) -{ - NotificationRequest request; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.PublishContinuousTaskNotification(request); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); -} - -/** - * @tc.name: CancelContinuousTaskNotification_00001 - * @tc.desc: Test CancelContinuousTaskNotification parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, CancelContinuousTaskNotification_00001, Function | SmallTest | Level1) -{ - std::string label = "label"; - int32_t notificationId = 10; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.CancelContinuousTaskNotification(label, notificationId); - EXPECT_EQ(ret, (int)ERR_OK); -} - -/** - * @tc.name: IsSupportTemplate_00001 - * @tc.desc: Test IsSupportTemplate parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, IsSupportTemplate_00001, Function | SmallTest | Level1) -{ - std::string templateName = "TemplateName"; - bool support = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.IsSupportTemplate(templateName, support); - EXPECT_EQ(ret, (int)ERR_OK); -} - -/** - * @tc.name: SetNotificationsEnabledForAllBundles_00002 - * @tc.desc: Test SetNotificationsEnabledForAllBundles parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, SetNotificationsEnabledForAllBundles_00002, Function | SmallTest | Level1) -{ - int32_t userId = 10; - bool enabled = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.SetNotificationsEnabledForAllBundles(userId, enabled); - EXPECT_EQ(ret, (int)ERR_OK); -} - -/** - * @tc.name: IsSupportTemplate_00002 - * @tc.desc: Test IsSupportTemplate parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, IsSupportTemplate_00002, Function | SmallTest | Level1) -{ - std::string templateName = "TemplateName"; - bool support = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.IsSupportTemplate(templateName, support); - EXPECT_EQ(ret, (int)ERR_OK); -} - -/** - * @tc.name: IsAllowedNotify_00004 - * @tc.desc: Test IsAllowedNotify parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, IsAllowedNotify_00004, Function | SmallTest | Level1) -{ - int32_t userId = 10; - bool allowed = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.IsAllowedNotify(userId, allowed); - EXPECT_EQ(ret, (int)ERR_OK); -} - -/** - * @tc.name: SetNotificationsEnabledForAllBundles_00003 - * @tc.desc: Test SetNotificationsEnabledForAllBundles parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, SetNotificationsEnabledForAllBundles_00003, Function | SmallTest | Level1) -{ - int32_t userId = 10; - bool enabled = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.SetNotificationsEnabledForAllBundles(userId, enabled); - EXPECT_EQ(ret, (int)ERR_OK); -} - -/** - * @tc.name: RemoveNotifications_00002 - * @tc.desc: Test RemoveNotifications parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, RemoveNotifications_00002, Function | SmallTest | Level1) -{ - int32_t userId = 10; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.RemoveNotifications(userId); - EXPECT_EQ(ret, (int)ERR_OK); -} - -/** - * @tc.name: SetDoNotDisturbDate_00002 - * @tc.desc: Test SetDoNotDisturbDate parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, SetDoNotDisturbDate_00002, Function | SmallTest | Level1) -{ - int32_t userId = 10; - NotificationDoNotDisturbDate doNotDisturbDate; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.SetDoNotDisturbDate(userId, doNotDisturbDate); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); -} - -/** - * @tc.name: GetDoNotDisturbDate_00002 - * @tc.desc: Test GetDoNotDisturbDate parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, GetDoNotDisturbDate_00002, Function | SmallTest | Level1) -{ - int32_t userId = 10; - NotificationDoNotDisturbDate doNotDisturbDate; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.GetDoNotDisturbDate(userId, doNotDisturbDate); - EXPECT_EQ(ret, (int)ERR_OK); -} - -/** - * @tc.name: SetEnabledForBundleSlot_00001 - * @tc.desc: Test SetEnabledForBundleSlot parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, SetEnabledForBundleSlot_00001, Function | SmallTest | Level1) -{ - NotificationBundleOption bundleOption; - NotificationConstant::SlotType slotType = NotificationConstant::SlotType::SERVICE_REMINDER; - bool enabled = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.SetEnabledForBundleSlot(bundleOption, slotType, enabled); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); -} - -/** - * @tc.name: GetEnabledForBundleSlot_00001 - * @tc.desc: Test GetEnabledForBundleSlot parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, GetEnabledForBundleSlot_00001, Function | SmallTest | Level1) -{ - NotificationBundleOption bundleOption; - NotificationConstant::SlotType slotType = NotificationConstant::SlotType::SERVICE_REMINDER; - bool enabled = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.GetEnabledForBundleSlot(bundleOption, slotType, enabled); - EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); -} - -/** - * @tc.name: SetSyncNotificationEnabledWithoutApp_00001 - * @tc.desc: Test SetSyncNotificationEnabledWithoutApp parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, SetSyncNotificationEnabledWithoutApp_00001, Function | SmallTest | Level1) -{ - int32_t userId = 10; - bool enabled = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.SetSyncNotificationEnabledWithoutApp(userId, enabled); - EXPECT_EQ(ret, (int)ERR_OK); -} - -/** - * @tc.name: GetSyncNotificationEnabledWithoutApp_00001 - * @tc.desc: Test GetSyncNotificationEnabledWithoutApp parameters. - * @tc.type: FUNC - * @tc.require: issueI5WRQ2 - */ -HWTEST_F(NotificationHelperTest, GetSyncNotificationEnabledWithoutApp_00001, Function | SmallTest | Level1) -{ - int32_t userId = 10; - bool enabled = true; - NotificationHelper notificationHelper; - ErrCode ret = notificationHelper.GetSyncNotificationEnabledWithoutApp(userId, enabled); - EXPECT_EQ(ret, (int)ERR_OK); -} -} +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#include "notification_bundle_option.h" +#include "notification_do_not_disturb_date.h" +#include "enabled_notification_callback_data.h" +#include "notification_request.h" +#include "notification_slot.h" +#include "notification_sorting_map.h" +#include "notification_subscriber.h" +#include "ans_inner_errors.h" +#include "errors.h" +#include "notification_helper.h" + +using namespace testing::ext; +namespace OHOS { +namespace Notification { +class NotificationHelperTest : public testing::Test { +public: + static void SetUpTestCase() {} + static void TearDownTestCase() {} + void SetUp() {} + void TearDown() {} +}; + +/** + * @tc.name: AddNotificationSlot_00001 + * @tc.desc: Test AddNotificationSlot parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, AddNotificationSlot_00001, Function | SmallTest | Level1) +{ + NotificationSlot slot; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.AddNotificationSlot(slot); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); +} + +/** + * @tc.name: AddSlotByType_00001 + * @tc.desc: Test AddSlotByType parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, AddSlotByType_00001, Function | SmallTest | Level1) +{ + NotificationConstant::SlotType slotType = NotificationConstant::SlotType::SERVICE_REMINDER; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.AddSlotByType(slotType); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); +} + +/** + * @tc.name: AddNotificationSlots_00001 + * @tc.desc: Test AddNotificationSlots parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, AddNotificationSlots_00001, Function | SmallTest | Level1) +{ + std::vector slots; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.AddNotificationSlots(slots); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); +} + +/** + * @tc.name: RemoveNotificationSlot_00001 + * @tc.desc: Test RemoveNotificationSlot parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, RemoveNotificationSlot_00001, Function | SmallTest | Level1) +{ + NotificationConstant::SlotType slotType = NotificationConstant::SlotType::SERVICE_REMINDER; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.RemoveNotificationSlot(slotType); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); +} + +/** + * @tc.name: RemoveAllSlots_00001 + * @tc.desc: Test RemoveAllSlots parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, RemoveAllSlots_00001, Function | SmallTest | Level1) +{ + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.RemoveAllSlots(); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); +} + +/** + * @tc.name: GetNotificationSlot_00001 + * @tc.desc: Test GetNotificationSlot parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, GetNotificationSlot_00001, Function | SmallTest | Level1) +{ + NotificationConstant::SlotType slotType = NotificationConstant::SlotType::SERVICE_REMINDER; + sptr slot = nullptr; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.GetNotificationSlot(slotType, slot); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); +} + +/** + * @tc.name: GetNotificationSlots_00001 + * @tc.desc: Test GetNotificationSlots parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, GetNotificationSlots_00001, Function | SmallTest | Level1) +{ + std::vector> slots; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.GetNotificationSlots(slots); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); +} + +/** + * @tc.name: GetNotificationSlotNumAsBundle_00001 + * @tc.desc: Test GetNotificationSlotNumAsBundle parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, GetNotificationSlotNumAsBundle_00001, Function | SmallTest | Level1) +{ + NotificationBundleOption bundleOption; + uint64_t num = 10; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.GetNotificationSlotNumAsBundle(bundleOption, num); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); +} + +/** + * @tc.name: PublishNotification_00001 + * @tc.desc: Test PublishNotification parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, PublishNotification_00001, Function | SmallTest | Level1) +{ + NotificationRequest request; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.PublishNotification(request); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); +} + +/** + * @tc.name: PublishNotification_00002 + * @tc.desc: Test PublishNotification parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, PublishNotification_00002, Function | SmallTest | Level1) +{ + NotificationRequest request; + std::string deviceId = "DeviceId"; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.PublishNotification(request, deviceId); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); +} + +/** + * @tc.name: PublishNotification_00003 + * @tc.desc: Test PublishNotification parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, PublishNotification_00003, Function | SmallTest | Level1) +{ + std::string label = "Label"; + NotificationRequest request; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.PublishNotification(label, request); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); +} + +/** + * @tc.name: CancelNotification_00001 + * @tc.desc: Test CancelNotification parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, CancelNotification_00001, Function | SmallTest | Level1) +{ + int32_t notificationId = 10; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.CancelNotification(notificationId); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); +} + +/** + * @tc.name: CancelNotification_00002 + * @tc.desc: Test CancelNotification parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, CancelNotification_00002, Function | SmallTest | Level1) +{ + std::string label = "Label"; + int32_t notificationId = 10; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.CancelNotification(label, notificationId); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); +} + +/** + * @tc.name: CancelAllNotifications_00001 + * @tc.desc: Test CancelAllNotifications parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, CancelAllNotifications_00001, Function | SmallTest | Level1) +{ + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.CancelAllNotifications(); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); +} + +/** + * @tc.name: CancelAsBundle_00001 + * @tc.desc: Test CancelAsBundle parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, CancelAsBundle_00001, Function | SmallTest | Level1) +{ + int32_t notificationId = 10; + std::string representativeBundle = "RepresentativeBundle"; + int32_t userId = 10; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.CancelAsBundle(notificationId, representativeBundle, userId); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_UID); +} + +/** + * @tc.name: GetActiveNotificationNums_00001 + * @tc.desc: Test GetActiveNotificationNums parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, GetActiveNotificationNums_00001, Function | SmallTest | Level1) +{ + uint64_t num = 10; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.GetActiveNotificationNums(num); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); +} + +/** + * @tc.name: GetActiveNotifications_00001 + * @tc.desc: Test GetActiveNotifications parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, GetActiveNotifications_00001, Function | SmallTest | Level1) +{ + std::vector> request; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.GetActiveNotifications(request); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); +} + +/** + * @tc.name: GetCurrentAppSorting_00001 + * @tc.desc: Test GetCurrentAppSorting parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, GetCurrentAppSorting_00001, Function | SmallTest | Level1) +{ + sptr sortingMap = nullptr; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.GetCurrentAppSorting(sortingMap); + EXPECT_EQ(ret, (int)ERR_ANS_PARCELABLE_FAILED); +} + +/** + * @tc.name: SetNotificationAgent_00001 + * @tc.desc: Test SetNotificationAgent parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, SetNotificationAgent_00001, Function | SmallTest | Level1) +{ + std::string agent = "Agent"; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.SetNotificationAgent(agent); + EXPECT_EQ(ret, (int)ERR_INVALID_OPERATION); +} + +/** + * @tc.name: GetNotificationAgent_00001 + * @tc.desc: Test GetNotificationAgent parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, GetNotificationAgent_00001, Function | SmallTest | Level1) +{ + std::string agent = "Agent"; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.GetNotificationAgent(agent); + EXPECT_EQ(ret, (int)ERR_INVALID_OPERATION); +} + +/** + * @tc.name: CanPublishNotificationAsBundle_00001 + * @tc.desc: Test CanPublishNotificationAsBundle parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, CanPublishNotificationAsBundle_00001, Function | SmallTest | Level1) +{ + std::string representativeBundle = "RepresentativeBundle"; + bool canPublish = true; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.CanPublishNotificationAsBundle(representativeBundle, canPublish); + EXPECT_EQ(ret, (int)ERR_INVALID_OPERATION); +} + +/** + * @tc.name: PublishNotificationAsBundle_00001 + * @tc.desc: Test PublishNotificationAsBundle parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, PublishNotificationAsBundle_00001, Function | SmallTest | Level1) +{ + std::string representativeBundle = "RepresentativeBundle"; + NotificationRequest request; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.PublishNotificationAsBundle(representativeBundle, request); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); +} + +/** + * @tc.name: SetNotificationBadgeNum_00001 + * @tc.desc: Test SetNotificationBadgeNum parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, SetNotificationBadgeNum_00001, Function | SmallTest | Level1) +{ + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.SetNotificationBadgeNum(); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); +} + +/** + * @tc.name: SetNotificationBadgeNum_00002 + * @tc.desc: Test SetNotificationBadgeNum parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, SetNotificationBadgeNum_00002, Function | SmallTest | Level1) +{ + int32_t num = 10; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.SetNotificationBadgeNum(num); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); +} + +/** + * @tc.name: IsAllowedNotify_00001 + * @tc.desc: Test IsAllowedNotify parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, IsAllowedNotify_00001, Function | SmallTest | Level1) +{ + bool allowed = true; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.IsAllowedNotify(allowed); + EXPECT_EQ(ret, (int)ERR_OK); +} + +/** + * @tc.name: IsAllowedNotifySelf_00001 + * @tc.desc: Test IsAllowedNotifySelf parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, IsAllowedNotifySelf_00001, Function | SmallTest | Level1) +{ + bool allowed = true; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.IsAllowedNotifySelf(allowed); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); +} + +/** + * @tc.name: RequestEnableNotification_00001 + * @tc.desc: Test RequestEnableNotification parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, RequestEnableNotification_00001, Function | SmallTest | Level1) +{ + std::string deviceId = "DeviceId"; + NotificationHelper notificationHelper; + bool needPop = true; + ErrCode ret = notificationHelper.RequestEnableNotification(deviceId, needPop); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); +} + +/** + * @tc.name: AreNotificationsSuspended_00001 + * @tc.desc: Test AreNotificationsSuspended parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, AreNotificationsSuspended_00001, Function | SmallTest | Level1) +{ + bool suspended = true; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.AreNotificationsSuspended(suspended); + EXPECT_EQ(ret, (int)ERR_INVALID_OPERATION); +} + +/** + * @tc.name: HasNotificationPolicyAccessPermission_00001 + * @tc.desc: Test HasNotificationPolicyAccessPermission parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, HasNotificationPolicyAccessPermission_00001, Function | SmallTest | Level1) +{ + bool hasPermission = true; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.HasNotificationPolicyAccessPermission(hasPermission); + EXPECT_EQ(ret, (int)ERR_OK); +} + +/** + * @tc.name: GetBundleImportance_00001 + * @tc.desc: Test GetBundleImportance parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, GetBundleImportance_00001, Function | SmallTest | Level1) +{ + NotificationSlot::NotificationLevel importance = NotificationSlot::NotificationLevel::LEVEL_NONE; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.GetBundleImportance(importance); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); +} + +/** + * @tc.name: RemoveNotification_00001 + * @tc.desc: Test RemoveNotification parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, RemoveNotification_00001, Function | SmallTest | Level1) +{ + std::string key = "Key"; + int32_t removeReason = 2; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.RemoveNotification(key, removeReason); + EXPECT_EQ(ret, (int)ERR_ANS_NOTIFICATION_NOT_EXISTS); +} + +/** + * @tc.name: RemoveNotification_00002 + * @tc.desc: Test RemoveNotification parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, RemoveNotification_00002, Function | SmallTest | Level1) +{ + NotificationBundleOption bundleOption; + int32_t notificationId = 10; + std::string label = "Label"; + int32_t removeReason = 2; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.RemoveNotification(bundleOption, notificationId, label, removeReason); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); +} + +/** + * @tc.name: RemoveAllNotifications_00001 + * @tc.desc: Test RemoveAllNotifications parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, RemoveAllNotifications_00001, Function | SmallTest | Level1) +{ + NotificationBundleOption bundleOption; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.RemoveAllNotifications(bundleOption); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); +} + +/** + * @tc.name: RemoveNotificationsByBundle_00001 + * @tc.desc: Test RemoveNotificationsByBundle parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, RemoveNotificationsByBundle_00001, Function | SmallTest | Level1) +{ + NotificationBundleOption bundleOption; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.RemoveNotificationsByBundle(bundleOption); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); +} + +/** + * @tc.name: RemoveNotifications_00001 + * @tc.desc: Test RemoveNotifications parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, RemoveNotifications_00001, Function | SmallTest | Level1) +{ + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.RemoveNotifications(); + EXPECT_EQ(ret, (int)ERR_OK); +} + +/** + * @tc.name: GetNotificationSlotsForBundle_00001 + * @tc.desc: Test GetNotificationSlotsForBundle parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, GetNotificationSlotsForBundle_00001, Function | SmallTest | Level1) +{ + NotificationBundleOption bundleOption; + std::vector> slots; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.GetNotificationSlotsForBundle(bundleOption, slots); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); +} + +/** + * @tc.name: UpdateNotificationSlots_00001 + * @tc.desc: Test UpdateNotificationSlots parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, UpdateNotificationSlots_00001, Function | SmallTest | Level1) +{ + NotificationBundleOption bundleOption; + std::vector> slots; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.UpdateNotificationSlots(bundleOption, slots); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); +} + +/** + * @tc.name: GetAllActiveNotifications_00001 + * @tc.desc: Test GetAllActiveNotifications parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, GetAllActiveNotifications_00001, Function | SmallTest | Level1) +{ + std::vector> notification; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.GetAllActiveNotifications(notification); + EXPECT_EQ(ret, (int)ERR_OK); +} + +/** + * @tc.name: GetAllActiveNotifications_00002 + * @tc.desc: Test GetAllActiveNotifications parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, GetAllActiveNotifications_00002, Function | SmallTest | Level1) +{ + std::vector key; + std::vector> notification; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.GetAllActiveNotifications(key, notification); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); +} + +/** + * @tc.name: IsAllowedNotify_00002 + * @tc.desc: Test IsAllowedNotify parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, IsAllowedNotify_00002, Function | SmallTest | Level1) +{ + NotificationBundleOption bundleOption; + bool allowed = true; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.IsAllowedNotify(bundleOption, allowed); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); +} + +/** + * @tc.name: SetNotificationsEnabledForAllBundles_00001 + * @tc.desc: Test SetNotificationsEnabledForAllBundles parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, SetNotificationsEnabledForAllBundles_00001, Function | SmallTest | Level1) +{ + std::string deviceId = "DeviceId"; + bool enabled = true; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.SetNotificationsEnabledForAllBundles(deviceId, enabled); + EXPECT_EQ(ret, (int)ERR_OK); +} + +/** + * @tc.name: SetNotificationsEnabledForDefaultBundle_00001 + * @tc.desc: Test SetNotificationsEnabledForDefaultBundle parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, SetNotificationsEnabledForDefaultBundle_00001, Function | SmallTest | Level1) +{ + std::string deviceId = "DeviceId"; + bool enabled = true; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.SetNotificationsEnabledForDefaultBundle(deviceId, enabled); + EXPECT_EQ(ret, (int)ERR_INVALID_OPERATION); +} + +/** + * @tc.name: SetShowBadgeEnabledForBundle_00001 + * @tc.desc: Test SetShowBadgeEnabledForBundle parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, SetShowBadgeEnabledForBundle_00001, Function | SmallTest | Level1) +{ + NotificationBundleOption bundleOption; + bool enabled = true; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.SetShowBadgeEnabledForBundle(bundleOption, enabled); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); +} + +/** + * @tc.name: GetShowBadgeEnabledForBundle_00001 + * @tc.desc: Test GetShowBadgeEnabledForBundle parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, GetShowBadgeEnabledForBundle_00001, Function | SmallTest | Level1) +{ + NotificationBundleOption bundleOption; + bool enabled = true; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.GetShowBadgeEnabledForBundle(bundleOption, enabled); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); +} + +/** + * @tc.name: GetShowBadgeEnabled_00001 + * @tc.desc: Test GetShowBadgeEnabled parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, GetShowBadgeEnabled_00001, Function | SmallTest | Level1) +{ + bool enabled = true; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.GetShowBadgeEnabled(enabled); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); +} + +/** + * @tc.name: CancelGroup_00001 + * @tc.desc: Test CancelGroup parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, CancelGroup_00001, Function | SmallTest | Level1) +{ + std::string groupName = "GroupName"; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.CancelGroup(groupName); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); +} + +/** + * @tc.name: RemoveGroupByBundle_00001 + * @tc.desc: Test RemoveGroupByBundle parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, RemoveGroupByBundle_00001, Function | SmallTest | Level1) +{ + NotificationBundleOption bundleOption; + std::string groupName = "GroupName"; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.RemoveGroupByBundle(bundleOption, groupName); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); +} + +/** + * @tc.name: SetDoNotDisturbDate_00001 + * @tc.desc: Test SetDoNotDisturbDate parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, SetDoNotDisturbDate_00001, Function | SmallTest | Level1) +{ + NotificationDoNotDisturbDate doNotDisturbDate; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.SetDoNotDisturbDate(doNotDisturbDate); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); +} + +/** + * @tc.name: GetDoNotDisturbDate_00001 + * @tc.desc: Test GetDoNotDisturbDate parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, GetDoNotDisturbDate_00001, Function | SmallTest | Level1) +{ + NotificationDoNotDisturbDate doNotDisturbDate; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.GetDoNotDisturbDate(doNotDisturbDate); + EXPECT_EQ(ret, (int)ERR_OK); +} + +/** + * @tc.name: DoesSupportDoNotDisturbMode_00001 + * @tc.desc: Test DoesSupportDoNotDisturbMode parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, DoesSupportDoNotDisturbMode_00001, Function | SmallTest | Level1) +{ + bool doesSupport = true; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.DoesSupportDoNotDisturbMode(doesSupport); + EXPECT_EQ(ret, (int)ERR_OK); +} + +/** + * @tc.name: IsDistributedEnabled_00001 + * @tc.desc: Test IsDistributedEnabled parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, IsDistributedEnabled_00001, Function | SmallTest | Level1) +{ + bool enabled = true; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.IsDistributedEnabled(enabled); + EXPECT_EQ(ret, (int)ERR_OK); +} + +/** + * @tc.name: EnableDistributed_00001 + * @tc.desc: Test EnableDistributed parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, EnableDistributed_00001, Function | SmallTest | Level1) +{ + bool enabled = true; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.EnableDistributed(enabled); + EXPECT_EQ(ret, (int)ERR_OK); +} + +/** + * @tc.name: EnableDistributedByBundle_00001 + * @tc.desc: Test EnableDistributedByBundle parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, EnableDistributedByBundle_00001, Function | SmallTest | Level1) +{ + NotificationBundleOption bundleOption; + bool enabled = true; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.EnableDistributedByBundle(bundleOption, enabled); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); +} + +/** + * @tc.name: EnableDistributedSelf_00001 + * @tc.desc: Test EnableDistributedSelf parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, EnableDistributedSelf_00001, Function | SmallTest | Level1) +{ + bool enabled = true; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.EnableDistributedSelf(enabled); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); +} + +/** + * @tc.name: IsDistributedEnableByBundle_00001 + * @tc.desc: Test IsDistributedEnableByBundle parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, IsDistributedEnableByBundle_00001, Function | SmallTest | Level1) +{ + NotificationBundleOption bundleOption; + bool enabled = true; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.IsDistributedEnableByBundle(bundleOption, enabled); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); +} + +/** + * @tc.name: GetDeviceRemindType_00001 + * @tc.desc: Test GetDeviceRemindType parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, GetDeviceRemindType_00001, Function | SmallTest | Level1) +{ + NotificationConstant::RemindType remindType = NotificationConstant::RemindType::DEVICE_ACTIVE_REMIND; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.GetDeviceRemindType(remindType); + EXPECT_EQ(ret, (int)ERR_OK); +} + +/** + * @tc.name: PublishContinuousTaskNotification_00001 + * @tc.desc: Test PublishContinuousTaskNotification parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, PublishContinuousTaskNotification_00001, Function | SmallTest | Level1) +{ + NotificationRequest request; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.PublishContinuousTaskNotification(request); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); +} + +/** + * @tc.name: CancelContinuousTaskNotification_00001 + * @tc.desc: Test CancelContinuousTaskNotification parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, CancelContinuousTaskNotification_00001, Function | SmallTest | Level1) +{ + std::string label = "label"; + int32_t notificationId = 10; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.CancelContinuousTaskNotification(label, notificationId); + EXPECT_EQ(ret, (int)ERR_OK); +} + +/** + * @tc.name: IsSupportTemplate_00001 + * @tc.desc: Test IsSupportTemplate parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, IsSupportTemplate_00001, Function | SmallTest | Level1) +{ + std::string templateName = "TemplateName"; + bool support = true; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.IsSupportTemplate(templateName, support); + EXPECT_EQ(ret, (int)ERR_OK); +} + +/** + * @tc.name: SetNotificationsEnabledForAllBundles_00002 + * @tc.desc: Test SetNotificationsEnabledForAllBundles parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, SetNotificationsEnabledForAllBundles_00002, Function | SmallTest | Level1) +{ + int32_t userId = 10; + bool enabled = true; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.SetNotificationsEnabledForAllBundles(userId, enabled); + EXPECT_EQ(ret, (int)ERR_OK); +} + +/** + * @tc.name: IsSupportTemplate_00002 + * @tc.desc: Test IsSupportTemplate parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, IsSupportTemplate_00002, Function | SmallTest | Level1) +{ + std::string templateName = "TemplateName"; + bool support = true; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.IsSupportTemplate(templateName, support); + EXPECT_EQ(ret, (int)ERR_OK); +} + +/** + * @tc.name: IsAllowedNotify_00004 + * @tc.desc: Test IsAllowedNotify parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, IsAllowedNotify_00004, Function | SmallTest | Level1) +{ + int32_t userId = 10; + bool allowed = true; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.IsAllowedNotify(userId, allowed); + EXPECT_EQ(ret, (int)ERR_OK); +} + +/** + * @tc.name: SetNotificationsEnabledForAllBundles_00003 + * @tc.desc: Test SetNotificationsEnabledForAllBundles parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, SetNotificationsEnabledForAllBundles_00003, Function | SmallTest | Level1) +{ + int32_t userId = 10; + bool enabled = true; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.SetNotificationsEnabledForAllBundles(userId, enabled); + EXPECT_EQ(ret, (int)ERR_OK); +} + +/** + * @tc.name: RemoveNotifications_00002 + * @tc.desc: Test RemoveNotifications parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, RemoveNotifications_00002, Function | SmallTest | Level1) +{ + int32_t userId = 10; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.RemoveNotifications(userId); + EXPECT_EQ(ret, (int)ERR_OK); +} + +/** + * @tc.name: SetDoNotDisturbDate_00002 + * @tc.desc: Test SetDoNotDisturbDate parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, SetDoNotDisturbDate_00002, Function | SmallTest | Level1) +{ + int32_t userId = 10; + NotificationDoNotDisturbDate doNotDisturbDate; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.SetDoNotDisturbDate(userId, doNotDisturbDate); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_BUNDLE); +} + +/** + * @tc.name: GetDoNotDisturbDate_00002 + * @tc.desc: Test GetDoNotDisturbDate parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, GetDoNotDisturbDate_00002, Function | SmallTest | Level1) +{ + int32_t userId = 10; + NotificationDoNotDisturbDate doNotDisturbDate; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.GetDoNotDisturbDate(userId, doNotDisturbDate); + EXPECT_EQ(ret, (int)ERR_OK); +} + +/** + * @tc.name: SetEnabledForBundleSlot_00001 + * @tc.desc: Test SetEnabledForBundleSlot parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, SetEnabledForBundleSlot_00001, Function | SmallTest | Level1) +{ + NotificationBundleOption bundleOption; + NotificationConstant::SlotType slotType = NotificationConstant::SlotType::SERVICE_REMINDER; + bool enabled = true; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.SetEnabledForBundleSlot(bundleOption, slotType, enabled); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); +} + +/** + * @tc.name: GetEnabledForBundleSlot_00001 + * @tc.desc: Test GetEnabledForBundleSlot parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, GetEnabledForBundleSlot_00001, Function | SmallTest | Level1) +{ + NotificationBundleOption bundleOption; + NotificationConstant::SlotType slotType = NotificationConstant::SlotType::SERVICE_REMINDER; + bool enabled = true; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.GetEnabledForBundleSlot(bundleOption, slotType, enabled); + EXPECT_EQ(ret, (int)ERR_ANS_INVALID_PARAM); +} + +/** + * @tc.name: SetSyncNotificationEnabledWithoutApp_00001 + * @tc.desc: Test SetSyncNotificationEnabledWithoutApp parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, SetSyncNotificationEnabledWithoutApp_00001, Function | SmallTest | Level1) +{ + int32_t userId = 10; + bool enabled = true; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.SetSyncNotificationEnabledWithoutApp(userId, enabled); + EXPECT_EQ(ret, (int)ERR_OK); +} + +/** + * @tc.name: GetSyncNotificationEnabledWithoutApp_00001 + * @tc.desc: Test GetSyncNotificationEnabledWithoutApp parameters. + * @tc.type: FUNC + * @tc.require: issueI5WRQ2 + */ +HWTEST_F(NotificationHelperTest, GetSyncNotificationEnabledWithoutApp_00001, Function | SmallTest | Level1) +{ + int32_t userId = 10; + bool enabled = true; + NotificationHelper notificationHelper; + ErrCode ret = notificationHelper.GetSyncNotificationEnabledWithoutApp(userId, enabled); + EXPECT_EQ(ret, (int)ERR_OK); +} +} } \ No newline at end of file -- Gitee