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