1 /*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include <gtest/gtest.h>
17 #define private public
18 #define protected public
19 #include "mission_information.h"
20 #undef protected
21 #undef private
22 using namespace testing::ext;
23 using namespace OHOS;
24 using namespace OHOS::AppExecFwk;
25 namespace OHOS {
26 namespace AppExecFwk {
27 class MissionInformationTest : public testing::Test {
28 public:
29 static void SetUpTestCase(void);
30 static void TearDownTestCase(void);
31 void SetUp();
32 void TearDown();
33 std::shared_ptr<MissionInformation> missionInformation_;
34 };
SetUpTestCase(void)35 void MissionInformationTest::SetUpTestCase(void) {}
TearDownTestCase(void)36 void MissionInformationTest::TearDownTestCase(void) {}
SetUp(void)37 void MissionInformationTest::SetUp(void)
38 {
39 missionInformation_ = std::make_shared<MissionInformation>();
40 }
TearDown(void)41 void MissionInformationTest::TearDown(void)
42 {
43 missionInformation_ = nullptr;
44 }
45
46 /**
47 * @tc.number: AaFwk_Ability_Context_ReadFromParcel_001
48 * @tc.name: ReadFromParcel
49 * @tc.desc: Verification function ReadFromParcel and the result is true.
50 */
51 HWTEST_F(MissionInformationTest, AaFwk_Ability_Context_ReadFromParcel_001, Function | MediumTest | Level1)
52 {
53 Parcel parcel;
54 auto result = missionInformation_->ReadFromParcel(parcel);
55 EXPECT_TRUE(result);
56 }
57
58 /**
59 * @tc.number: AaFwk_Ability_Context_Marshalling_001
60 * @tc.name: Marshalling
61 * @tc.desc: Verification function Marshalling and the result is true.
62 */
63 HWTEST_F(MissionInformationTest, AaFwk_Ability_Context_Marshalling_001, Function | MediumTest | Level1)
64 {
65 Parcel parcel;
66 auto result = missionInformation_->Marshalling(parcel);
67 EXPECT_TRUE(result);
68 }
69
70 /**
71 * @tc.number: AaFwk_Ability_Context_Unmarshalling_001
72 * @tc.name: Unmarshalling
73 * @tc.desc: Verification function Unmarshalling and the result isn't nullptr.
74 */
75 HWTEST_F(MissionInformationTest, AaFwk_Ability_Context_Unmarshalling_001, Function | MediumTest | Level1)
76 {
77 Parcel parcel;
78 auto result = missionInformation_->Unmarshalling(parcel);
79 EXPECT_TRUE(result != nullptr);
80 }
81 } // namespace AppExecFwk
82 } // namespace OHOS