use of com.google.monitoring.v3.UptimeCheckConfig in project java-monitoring by googleapis.
the class UptimeCheckServiceClientTest method updateUptimeCheckConfigExceptionTest.
@Test
public void updateUptimeCheckConfigExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockUptimeCheckService.addException(exception);
try {
UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build();
client.updateUptimeCheckConfig(uptimeCheckConfig);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.monitoring.v3.UptimeCheckConfig in project java-monitoring by googleapis.
the class UptimeCheckServiceClientTest method listUptimeCheckConfigsTest4.
@Test
public void listUptimeCheckConfigsTest4() throws Exception {
UptimeCheckConfig responsesElement = UptimeCheckConfig.newBuilder().build();
ListUptimeCheckConfigsResponse expectedResponse = ListUptimeCheckConfigsResponse.newBuilder().setNextPageToken("").addAllUptimeCheckConfigs(Arrays.asList(responsesElement)).build();
mockUptimeCheckService.addResponse(expectedResponse);
String parent = "parent-995424086";
ListUptimeCheckConfigsPagedResponse pagedListResponse = client.listUptimeCheckConfigs(parent);
List<UptimeCheckConfig> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getUptimeCheckConfigsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockUptimeCheckService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListUptimeCheckConfigsRequest actualRequest = ((ListUptimeCheckConfigsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations