Skip to content

Commit

Permalink
chore: add test for enums in HTTP annotations (#737)
Browse files Browse the repository at this point in the history
  • Loading branch information
miraleung authored May 26, 2021
1 parent c4561c9 commit 842d7a3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ public class GrpcTestingStub extends TestingStub {
params.put("name", String.valueOf(request.getName()));
params.put(
"test_to_verify.name", String.valueOf(request.getTestToVerify().getName()));
params.put("type", String.valueOf(request.getType()));
return params.build();
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ public class TestingClientTest {
Assert.assertEquals(request.getAnswersList(), actualRequest.getAnswersList());
Assert.assertEquals(request.getFoo(), actualRequest.getFoo());
Assert.assertEquals(request.getTestToVerify(), actualRequest.getTestToVerify());
Assert.assertEquals(request.getType(), actualRequest.getType());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void parseHttpAnnotation_multipleBindings() {
HttpRuleParser.parseHttpBindings(rpcMethod, inputMessage, messages);
assertTrue(httpBindingsOpt.isPresent());
assertThat(httpBindingsOpt.get())
.containsExactly("answer", "foo", "name", "test_to_verify.name");
.containsExactly("answer", "foo", "name", "test_to_verify.name", "type");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ service Testing {
post: "/v1beta1/{test_to_verify.name=sessions/*/tests/*}:check"
body: "*"
}
// Test enums in HTTP fields.
additional_bindings { post: "/v1beta1/{type}:check" body: "*" }
};
}
}
Expand Down Expand Up @@ -410,6 +412,9 @@ message VerifyTestRequest {
string foo = 4;

Test test_to_verify = 5;

// For testing enums in HTTP fields.
Issue.Type type = 6;
}

message VerifyTestResponse {
Expand Down

0 comments on commit 842d7a3

Please sign in to comment.