2022-02-14

enforcing order of calling function in google mock

I am learning about using google mock. I have observed following code as sample to specify the order of function calls. Here we are using InSequence object but not used any where in code. Request to guide me what idea of C++ technique is used internally by TEST_F to use this object and enforce the oder

TEST_F(APlaceDescriptionService, MakesHttpRequestToObtainAddress) {
InSequence forceExpectationOrder;
HttpStub httpStub;
string urlStart{
"http://open.mapquestapi.com/nominatim/v1/reverse?format=json&"};
auto expectedURL = urlStart +
"lat=" + APlaceDescriptionService::ValidLatitude + "&" +
"lon=" + APlaceDescriptionService::ValidLongitude;
EXPECT_CALL(httpStub, initialize());
EXPECT_CALL(httpStub, get(expectedURL));
PlaceDescriptionService service{&httpStub};
service.summaryDescription(ValidLatitude, ValidLongitude);
}


from Recent Questions - Stack Overflow https://ift.tt/Bc0Nqbx
https://ift.tt/ln6XjYu

No comments:

Post a Comment