TEST(ProviderTest, unregister_attributeListener) { MockPublicationManager publicationManager; std::string attributeName("testAttribute"); std::string subscriptionId("test-subscription-id"); Variant attributeValue(Variant::make<int>(42)); // Expect the publicationManager not to be called when the attribute value changes EXPECT_CALL(publicationManager, attributeValueChanged(Eq(subscriptionId),Eq(attributeValue))) .Times(0); DummyProvider provider; // This should not contact the publicationManager provider.onAttributeValueChanged(attributeName, attributeValue); // Do a register then unregister SubscriptionAttributeListener* attributeListener = new SubscriptionAttributeListener(subscriptionId, publicationManager); provider.registerAttributeListener(attributeName, attributeListener); provider.unregisterAttributeListener(attributeName, attributeListener); // This should not contact the publicationManager provider.onAttributeValueChanged(attributeName, attributeValue); }