use of com.google.monitoring.v3.CreateUptimeCheckConfigRequest in project java-monitoring by googleapis.
the class UptimeCheckServiceClientTest method createUptimeCheckConfigTest.
@Test
public void createUptimeCheckConfigTest() throws Exception {
UptimeCheckConfig expectedResponse = UptimeCheckConfig.newBuilder().setName(UptimeCheckConfigName.ofProjectUptimeCheckConfigName("[PROJECT]", "[UPTIME_CHECK_CONFIG]").toString()).setDisplayName("displayName1714148973").setPeriod(Duration.newBuilder().build()).setTimeout(Duration.newBuilder().build()).addAllContentMatchers(new ArrayList<UptimeCheckConfig.ContentMatcher>()).addAllSelectedRegions(new ArrayList<UptimeCheckRegion>()).setIsInternal(true).addAllInternalCheckers(new ArrayList<InternalChecker>()).build();
mockUptimeCheckService.addResponse(expectedResponse);
FolderName parent = FolderName.of("[FOLDER]");
UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build();
UptimeCheckConfig actualResponse = client.createUptimeCheckConfig(parent, uptimeCheckConfig);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockUptimeCheckService.getRequests();
Assert.assertEquals(1, actualRequests.size());
CreateUptimeCheckConfigRequest actualRequest = ((CreateUptimeCheckConfigRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertEquals(uptimeCheckConfig, actualRequest.getUptimeCheckConfig());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations