Skip to content

Commit 58afe24

Browse files
modify an example test to use the new dummy AO event recorder feature.
1 parent e51fb62 commit 58afe24

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

examples/hwLockCtrlService/test/hwLockCtrlServiceTests.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -411,17 +411,8 @@ TEST(HwLockCtrlServiceTests, the_service_responds_to_a_ping_with_a_pong)
411411

412412
// this test demonstrates testing an AO that must respond directly
413413
// to an event with a POST directly to an external requesting AO.
414-
415-
PongEvent pongEvent;
416-
QEvt_ctor(&pongEvent.super, 0);
417-
418414
auto dummy = std::unique_ptr<cms::DefaultDummyActiveObject>(
419-
new cms::DefaultDummyActiveObject());
420-
dummy->SetPostedEventHandler([&pongEvent](const QEvt* event) {
421-
auto p = reinterpret_cast<const PongEvent *>(event);
422-
pongEvent.super.sig = p->super.sig;
423-
pongEvent.source = p->source;
424-
});
415+
new cms::DefaultDummyActiveObject(cms::DefaultDummyActiveObject::EventBehavior::RECORDER));
425416

426417
// Reminder: QF requires that each AO be at a unique priority level
427418
// hence the '- 1' below.
@@ -439,6 +430,8 @@ TEST(HwLockCtrlServiceTests, the_service_responds_to_a_ping_with_a_pong)
439430

440431
// confirm that our dummy received a Pong with expected
441432
// data.
442-
CHECK_EQUAL(RESPONSE_SIG, pongEvent.super.sig);
443-
CHECK_EQUAL(mUnderTest, pongEvent.source);
433+
auto recordedEvent = dummy->getRecordedEvent();
434+
CHECK_EQUAL(RESPONSE_SIG, recordedEvent->sig);
435+
auto pongEvent = (const PongEvent *)(recordedEvent.get());
436+
CHECK_EQUAL(mUnderTest, pongEvent->source);
444437
}

0 commit comments

Comments
 (0)