18 #include <gmock/gmock.h> 34 using canopen_chain_node::GetObjectRequest;
35 using canopen_chain_node::GetObjectResponse;
36 using canopen_chain_node::SetObjectRequest;
37 using canopen_chain_node::SetObjectResponse;
50 using ::testing::DoAll;
51 using ::testing::Field;
52 using ::testing::Return;
53 using ::testing::SetArgReferee;
55 GetObjectResponse duration_resp;
56 duration_resp.success =
true;
57 duration_resp.value =
"1";
59 SetObjectResponse start_resp;
60 start_resp.success =
true;
62 GetObjectResponse status_resp;
63 status_resp.success =
true;
64 status_resp.value =
"\x02";
68 .WillByDefault(DoAll(SetArgReferee<1>(duration_resp), Return(
true)));
72 .WillByDefault(DoAll(SetArgReferee<1>(start_resp), Return(
true)));
76 .WillByDefault(DoAll(SetArgReferee<1>(status_resp), Return(
true)));
82 using ::testing::AnyNumber;
83 using ::testing::Field;
85 EXPECT_CALL(*
this, get_obj(_, _))
87 EXPECT_CALL(*
this, set_obj(_, _))
92 *
this, get_obj(Field(&GetObjectRequest::node,
"gripper_joint"), _)
97 *
this, set_obj(Field(&SetObjectRequest::node,
"gripper_joint"), _)
void expectAnything()
Set expectations on all mock methods, that can be fullfilled in any case.
ros::ServiceServer set_obj_serv_
void shutdownSetService()
Un-advertise the set service.
static const std::string BRAKE_TEST_STATUS_OBJECT_INDEX
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
void shutdownGetService()
Un-advertise the get service.
ros::ServiceServer get_obj_serv_
void shutdown()
Un-advertise services.
void setDefaultActions()
Set default actions on all expected service calls.
static const std::string CANOPEN_GETOBJECT_SERVICE_NAME
static const std::string CANOPEN_SETOBJECT_SERVICE_NAME
static const std::string BRAKE_TEST_DURATION_OBJECT_INDEX
static const std::string START_BRAKE_TEST_OBJECT_INDEX
CANOpenChainNodeMock()
Advertise get_object and set_object services for CANOpen objects and call setDefaultActions().