dimanche 13 février 2022

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);
}

Aucun commentaire:

Enregistrer un commentaire