use of com.google.logging.v2.ListLogEntriesResponse in project google-cloud-java by GoogleCloudPlatform.
the class LoggingImplTest method testListLogEntries.
@Test
public void testListLogEntries() {
String cursor = "cursor";
EasyMock.replay(rpcFactoryMock);
logging = options.getService();
ListLogEntriesRequest request = ListLogEntriesRequest.newBuilder().addProjectIds(PROJECT).build();
List<LogEntry> entriesList = ImmutableList.of(LOG_ENTRY1, LOG_ENTRY2);
ListLogEntriesResponse response = ListLogEntriesResponse.newBuilder().setNextPageToken(cursor).addAllEntries(Lists.transform(entriesList, LogEntry.toPbFunction(PROJECT))).build();
ApiFuture<ListLogEntriesResponse> futureResponse = ApiFutures.immediateFuture(response);
EasyMock.expect(loggingRpcMock.list(request)).andReturn(futureResponse);
EasyMock.replay(loggingRpcMock);
Page<LogEntry> page = logging.listLogEntries();
assertEquals(cursor, page.getNextPageToken());
assertArrayEquals(entriesList.toArray(), Iterables.toArray(page.getValues(), LogEntry.class));
}
Aggregations