use of com.google.recaptchaenterprise.v1beta1.ListKeysResponse in project java-recaptchaenterprise by googleapis.
the class RecaptchaEnterpriseServiceClientTest method listKeysTest.
@Test
public void listKeysTest() throws Exception {
Key responsesElement = Key.newBuilder().build();
ListKeysResponse expectedResponse = ListKeysResponse.newBuilder().setNextPageToken("").addAllKeys(Arrays.asList(responsesElement)).build();
mockRecaptchaEnterpriseService.addResponse(expectedResponse);
ListKeysRequest request = ListKeysRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).setPageSize(883849137).setPageToken("pageToken873572522").build();
ListKeysPagedResponse pagedListResponse = client.listKeys(request);
List<Key> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getKeysList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockRecaptchaEnterpriseService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListKeysRequest actualRequest = ((ListKeysRequest) actualRequests.get(0));
Assert.assertEquals(request.getParent(), actualRequest.getParent());
Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize());
Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.recaptchaenterprise.v1beta1.ListKeysResponse in project java-recaptchaenterprise by googleapis.
the class RecaptchaEnterpriseServiceV1Beta1ClientTest method listKeysTest.
@Test
public void listKeysTest() throws Exception {
Key responsesElement = Key.newBuilder().build();
ListKeysResponse expectedResponse = ListKeysResponse.newBuilder().setNextPageToken("").addAllKeys(Arrays.asList(responsesElement)).build();
mockRecaptchaEnterpriseServiceV1Beta1.addResponse(expectedResponse);
ListKeysRequest request = ListKeysRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).setPageSize(883849137).setPageToken("pageToken873572522").build();
ListKeysPagedResponse pagedListResponse = client.listKeys(request);
List<Key> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getKeysList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockRecaptchaEnterpriseServiceV1Beta1.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListKeysRequest actualRequest = ((ListKeysRequest) actualRequests.get(0));
Assert.assertEquals(request.getParent(), actualRequest.getParent());
Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize());
Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations