Search in sources :

Example 1 with GetTopicRequest

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());
}
Also used : GetTopicRequest(com.google.pubsub.v1.GetTopicRequest) Topic(com.google.pubsub.v1.Topic) GeneratedMessageV3(com.google.protobuf.GeneratedMessageV3) TopicName(com.google.pubsub.v1.TopicName) Test(org.junit.Test)

Aggregations

GeneratedMessageV3 (com.google.protobuf.GeneratedMessageV3)1 GetTopicRequest (com.google.pubsub.v1.GetTopicRequest)1 Topic (com.google.pubsub.v1.Topic)1 TopicName (com.google.pubsub.v1.TopicName)1 Test (org.junit.Test)1