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