use of com.google.monitoring.v3.GetMonitoredResourceDescriptorRequest in project google-cloud-java by GoogleCloudPlatform.
the class MetricServiceClientTest method getMonitoredResourceDescriptorTest.
@Test
@SuppressWarnings("all")
public void getMonitoredResourceDescriptorTest() {
String name2 = "name2-1052831874";
String type = "type3575610";
String displayName = "displayName1615086568";
String description = "description-1724546052";
MonitoredResourceDescriptor expectedResponse = MonitoredResourceDescriptor.newBuilder().setName(name2).setType(type).setDisplayName(displayName).setDescription(description).build();
mockMetricService.addResponse(expectedResponse);
MonitoredResourceDescriptorName name = MonitoredResourceDescriptorName.create("[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]");
MonitoredResourceDescriptor actualResponse = client.getMonitoredResourceDescriptor(name);
Assert.assertEquals(expectedResponse, actualResponse);
List<GeneratedMessageV3> actualRequests = mockMetricService.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetMonitoredResourceDescriptorRequest actualRequest = (GetMonitoredResourceDescriptorRequest) actualRequests.get(0);
Assert.assertEquals(name, actualRequest.getNameAsMonitoredResourceDescriptorName());
}
Aggregations