Skip to content

Commit 2ad2ac9

Browse files
Refactor ClusterTester to improve command invocation and response handling
- Updated `Invoke` method in `ClusterTester` to handle response decoding more robustly, including support for `NullObjectType`. - Enhanced test for `JoinGroupCommand` to utilize the new invocation method. - Added necessary includes for `NullObjectType` in relevant files.
1 parent 92823ff commit 2ad2ac9

File tree

3 files changed

+258
-292
lines changed

3 files changed

+258
-292
lines changed

src/app/clusters/groupcast/tests/TestGroupcastCluster.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,10 @@ TEST_F(TestGroupcastCluster, TestJoinGroupCommand)
117117

118118
chip::app::Testing::MockCommandHandler cmdHandler;
119119
chip::Test::ClusterTester tester(cluster);
120-
auto result = tester.Invoke(Commands::JoinGroup::Id, cmdData, &cmdHandler);
121-
ASSERT_TRUE(result.has_value());
122-
EXPECT_EQ(result.value().GetStatusCode().GetStatus(), // NOLINT(bugprone-unchecked-optional-access)
120+
auto result = tester.Invoke<Commands::JoinGroup::Type::ResponseType,
121+
Commands::JoinGroup::Type>(Commands::JoinGroup::Id, cmdData);
122+
ASSERT_TRUE(result.status.has_value());
123+
EXPECT_EQ(result.status.value().GetStatusCode().GetStatus(), // NOLINT(bugprone-unchecked-optional-access)
123124
Protocols::InteractionModel::Status::Failure); // Currently expect Failure as JoinGroup command returns
124125
// CHIP_ERROR_NOT_IMPLEMENTED
125126
}

0 commit comments

Comments
 (0)