use of com.google.pubsub.v1.GetTopicRequest in project google-cloud-java by GoogleCloudPlatform.
the class TopicAdminClientTest method getTopicTest.
@Test
@SuppressWarnings("all")
public void getTopicTest() {
TopicName name = TopicName.create("[PROJECT]", "[TOPIC]");
Topic expectedResponse = Topic.newBuilder().setNameWithTopicName(name).build();
mockPublisher.addResponse(expectedResponse);
TopicName topic = TopicName.create("[PROJECT]", "[TOPIC]");
Topic actualResponse = client.getTopic(topic);
Assert.assertEquals(expectedResponse, actualResponse);
List<GeneratedMessageV3> actualRequests = mockPublisher.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetTopicRequest actualRequest = (GetTopicRequest) actualRequests.get(0);
Assert.assertEquals(topic, actualRequest.getTopicAsTopicName());
}
Aggregations