use of com.google.cloud.dialogflow.cx.v3beta1.ChangelogsClient.ListChangelogsPagedResponse in project java-dialogflow-cx by googleapis.
the class ChangelogsClientTest method listChangelogsTest.
@Test
public void listChangelogsTest() throws Exception {
Changelog responsesElement = Changelog.newBuilder().build();
ListChangelogsResponse expectedResponse = ListChangelogsResponse.newBuilder().setNextPageToken("").addAllChangelogs(Arrays.asList(responsesElement)).build();
mockChangelogs.addResponse(expectedResponse);
AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
ListChangelogsPagedResponse pagedListResponse = client.listChangelogs(parent);
List<Changelog> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getChangelogsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockChangelogs.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListChangelogsRequest actualRequest = ((ListChangelogsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.cx.v3beta1.ChangelogsClient.ListChangelogsPagedResponse in project java-dialogflow-cx by googleapis.
the class ChangelogsClientTest method listChangelogsTest.
@Test
public void listChangelogsTest() throws Exception {
Changelog responsesElement = Changelog.newBuilder().build();
ListChangelogsResponse expectedResponse = ListChangelogsResponse.newBuilder().setNextPageToken("").addAllChangelogs(Arrays.asList(responsesElement)).build();
mockChangelogs.addResponse(expectedResponse);
AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
ListChangelogsPagedResponse pagedListResponse = client.listChangelogs(parent);
List<Changelog> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getChangelogsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockChangelogs.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListChangelogsRequest actualRequest = ((ListChangelogsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.cx.v3beta1.ChangelogsClient.ListChangelogsPagedResponse in project java-dialogflow-cx by googleapis.
the class ChangelogsClientTest method listChangelogsTest2.
@Test
public void listChangelogsTest2() throws Exception {
Changelog responsesElement = Changelog.newBuilder().build();
ListChangelogsResponse expectedResponse = ListChangelogsResponse.newBuilder().setNextPageToken("").addAllChangelogs(Arrays.asList(responsesElement)).build();
mockChangelogs.addResponse(expectedResponse);
String parent = "parent-995424086";
ListChangelogsPagedResponse pagedListResponse = client.listChangelogs(parent);
List<Changelog> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getChangelogsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockChangelogs.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListChangelogsRequest actualRequest = ((ListChangelogsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.cx.v3beta1.ChangelogsClient.ListChangelogsPagedResponse in project java-dialogflow-cx by googleapis.
the class ChangelogsClientTest method listChangelogsTest2.
@Test
public void listChangelogsTest2() throws Exception {
Changelog responsesElement = Changelog.newBuilder().build();
ListChangelogsResponse expectedResponse = ListChangelogsResponse.newBuilder().setNextPageToken("").addAllChangelogs(Arrays.asList(responsesElement)).build();
mockChangelogs.addResponse(expectedResponse);
String parent = "parent-995424086";
ListChangelogsPagedResponse pagedListResponse = client.listChangelogs(parent);
List<Changelog> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getChangelogsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockChangelogs.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListChangelogsRequest actualRequest = ((ListChangelogsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations