use of com.google.monitoring.v3.UpdateServiceRequest in project java-monitoring by googleapis.
the class ServiceMonitoringServiceClientTest method updateServiceTest.
@Test
public void updateServiceTest() throws Exception {
Service expectedResponse = Service.newBuilder().setName(ServiceName.ofProjectServiceName("[PROJECT]", "[SERVICE]").toString()).setDisplayName("displayName1714148973").setTelemetry(Service.Telemetry.newBuilder().build()).putAllUserLabels(new HashMap<String, String>()).build();
mockServiceMonitoringService.addResponse(expectedResponse);
Service service = Service.newBuilder().build();
Service actualResponse = client.updateService(service);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockServiceMonitoringService.getRequests();
Assert.assertEquals(1, actualRequests.size());
UpdateServiceRequest actualRequest = ((UpdateServiceRequest) actualRequests.get(0));
Assert.assertEquals(service, actualRequest.getService());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations