@@ -23,12 +23,14 @@ namespace generator_internal {
2323namespace {
2424
2525using ::google::cloud::testing_util::IsOk;
26+ using ::google::cloud::testing_util::IsOkAndHolds;
2627using ::google::cloud::testing_util::StatusIs;
2728using ::testing::AllOf;
2829using ::testing::Contains;
2930using ::testing::Eq;
3031using ::testing::HasSubstr;
3132using ::testing::IsEmpty;
33+ using ::testing::IsNull;
3234using ::testing::Key;
3335using ::testing::SizeIs;
3436using ::testing::UnorderedElementsAre;
@@ -213,10 +215,9 @@ TEST(DetermineAndVerifyResponseTypeNameTest, ResponseWithRef) {
213215 DiscoveryResource resource;
214216 std::map<std::string, DiscoveryTypeVertex> types;
215217 types.emplace (" Foo" , DiscoveryTypeVertex{" Foo" , " " , response_type_json});
216- auto response =
217- DetermineAndVerifyResponseTypeName (method_json, resource, types);
218+ auto response = DetermineAndVerifyResponseType (method_json, resource, types);
218219 ASSERT_STATUS_OK (response);
219- EXPECT_THAT (*response, Eq (" Foo" ));
220+ EXPECT_THAT (( *response)-> name () , Eq (" Foo" ));
220221}
221222
222223TEST (DetermineAndVerifyResponseTypeNameTest, ResponseMissingRef) {
@@ -233,8 +234,7 @@ TEST(DetermineAndVerifyResponseTypeNameTest, ResponseMissingRef) {
233234 DiscoveryResource resource;
234235 std::map<std::string, DiscoveryTypeVertex> types;
235236 types.emplace (" Foo" , DiscoveryTypeVertex{" Foo" , " " , response_type_json});
236- auto response =
237- DetermineAndVerifyResponseTypeName (method_json, resource, types);
237+ auto response = DetermineAndVerifyResponseType (method_json, resource, types);
238238 EXPECT_THAT (response, StatusIs (StatusCode::kInvalidArgument ,
239239 HasSubstr (" Missing $ref field in response" )));
240240}
@@ -250,10 +250,8 @@ TEST(DetermineAndVerifyResponseTypeNameTest, ResponseFieldMissing) {
250250 DiscoveryResource resource;
251251 std::map<std::string, DiscoveryTypeVertex> types;
252252 types.emplace (" Foo" , DiscoveryTypeVertex{" Foo" , " " , response_type_json});
253- auto response =
254- DetermineAndVerifyResponseTypeName (method_json, resource, types);
255- ASSERT_STATUS_OK (response);
256- EXPECT_THAT (*response, IsEmpty ());
253+ auto response = DetermineAndVerifyResponseType (method_json, resource, types);
254+ EXPECT_THAT (response, IsOkAndHolds (IsNull ()));
257255}
258256
259257TEST (SynthesizeRequestTypeTest, OperationResponseWithRefRequestField) {
@@ -603,11 +601,14 @@ TEST(ProcessMethodRequestsAndResponsesTest, RequestWithOperationResponse) {
603601 resources.emplace (" foos" ,
604602 DiscoveryResource (" foos" , " " , " " , " " , resource_json));
605603 std::map<std::string, DiscoveryTypeVertex> types;
606- types.emplace (" Operation" , DiscoveryTypeVertex (" " , " " , operation_type_json));
604+ types.emplace (" Operation" ,
605+ DiscoveryTypeVertex (" Operation" , " " , operation_type_json));
607606 auto result = ProcessMethodRequestsAndResponses (resources, types);
608607 ASSERT_STATUS_OK (result);
609608 EXPECT_THAT (
610609 types, UnorderedElementsAre (Key (" Foos.CreateRequest" ), Key (" Operation" )));
610+ EXPECT_THAT (resources.begin ()->second .response_types (),
611+ UnorderedElementsAre (Key (" Operation" )));
611612}
612613
613614TEST (ProcessMethodRequestsAndResponsesTest, MethodWithEmptyRequest) {
0 commit comments