use of com.google.monitoring.v3.GroupName in project google-cloud-java by GoogleCloudPlatform.
the class ErrorGroupServiceClientTest method getGroupTest.
@Test
@SuppressWarnings("all")
public void getGroupTest() {
GroupName name = GroupName.create("[PROJECT]", "[GROUP]");
String groupId = "groupId506361563";
ErrorGroup expectedResponse = ErrorGroup.newBuilder().setNameWithGroupName(name).setGroupId(groupId).build();
mockErrorGroupService.addResponse(expectedResponse);
GroupName groupName = GroupName.create("[PROJECT]", "[GROUP]");
ErrorGroup actualResponse = client.getGroup(groupName);
Assert.assertEquals(expectedResponse, actualResponse);
List<GeneratedMessageV3> actualRequests = mockErrorGroupService.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetGroupRequest actualRequest = (GetGroupRequest) actualRequests.get(0);
Assert.assertEquals(groupName, actualRequest.getGroupNameAsGroupName());
}
use of com.google.monitoring.v3.GroupName in project google-cloud-java by GoogleCloudPlatform.
the class ErrorGroupServiceClientTest method getGroupExceptionTest.
@Test
@SuppressWarnings("all")
public void getGroupExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockErrorGroupService.addException(exception);
try {
GroupName groupName = GroupName.create("[PROJECT]", "[GROUP]");
client.getGroup(groupName);
Assert.fail("No exception raised");
} catch (ApiException e) {
Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());
}
}
Aggregations