use of com.google.pubsub.v1.PushConfig in project google-cloud-java by GoogleCloudPlatform.
the class SubscriptionAdminClientTest method modifyPushConfigTest.
@Test
@SuppressWarnings("all")
public void modifyPushConfigTest() {
Empty expectedResponse = Empty.newBuilder().build();
mockSubscriber.addResponse(expectedResponse);
SubscriptionName subscription = SubscriptionName.create("[PROJECT]", "[SUBSCRIPTION]");
PushConfig pushConfig = PushConfig.newBuilder().build();
client.modifyPushConfig(subscription, pushConfig);
List<GeneratedMessageV3> actualRequests = mockSubscriber.getRequests();
Assert.assertEquals(1, actualRequests.size());
ModifyPushConfigRequest actualRequest = (ModifyPushConfigRequest) actualRequests.get(0);
Assert.assertEquals(subscription, actualRequest.getSubscriptionAsSubscriptionName());
Assert.assertEquals(pushConfig, actualRequest.getPushConfig());
}
use of com.google.pubsub.v1.PushConfig in project google-cloud-java by GoogleCloudPlatform.
the class SubscriptionAdminClientTest method modifyPushConfigExceptionTest.
@Test
@SuppressWarnings("all")
public void modifyPushConfigExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockSubscriber.addException(exception);
try {
SubscriptionName subscription = SubscriptionName.create("[PROJECT]", "[SUBSCRIPTION]");
PushConfig pushConfig = PushConfig.newBuilder().build();
client.modifyPushConfig(subscription, pushConfig);
Assert.fail("No exception raised");
} catch (ApiException e) {
Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());
}
}
Aggregations