@Test void testGetRecentLogsWithOffsetReturnsFilteredLogs() { LogsOffset offset = createLogsOffset(1, ""); Mockito.when(client.getRecentLogs(APP_NAME)) .thenReturn(List.of(createAppLog(1, ""), createAppLog(2, ""))); assertEquals(List.of(createAppLog(2, "")), recentLogsRetriever.getRecentLogs(client, APP_NAME, offset)); }
public List<ApplicationLog> getRecentLogs(CloudControllerClient client, String appName, LogsOffset offset) { List<ApplicationLog> appLogs = client.getRecentLogs(appName); if (offset == null) { return appLogs; } return appLogs.stream() .filter(appLog -> isLogNew(appLog, offset)) .collect(Collectors.toList()); }
RecentLogsRetriever { public List<ApplicationLog> getRecentLogs(CloudControllerClient client, String appName, LogsOffset offset) { List<ApplicationLog> appLogs = client.getRecentLogs(appName); if (offset == null) { return appLogs; } return appLogs.stream() .filter(appLog -> isLogNew(appLog, offset)) .collect(Collectors.toList()); } }
RecentLogsRetriever { public List<ApplicationLog> getRecentLogs(CloudControllerClient client, String appName, LogsOffset offset) { List<ApplicationLog> appLogs = client.getRecentLogs(appName); if (offset == null) { return appLogs; } return appLogs.stream() .filter(appLog -> isLogNew(appLog, offset)) .collect(Collectors.toList()); }  }
RecentLogsRetriever { public List<ApplicationLog> getRecentLogs(CloudControllerClient client, String appName, LogsOffset offset) { List<ApplicationLog> appLogs = client.getRecentLogs(appName); if (offset == null) { return appLogs; } return appLogs.stream() .filter(appLog -> isLogNew(appLog, offset)) .collect(Collectors.toList()); }  List<ApplicationLog> getRecentLogsSafely(CloudControllerClient client, String appName, LogsOffset offset); List<ApplicationLog> getRecentLogs(CloudControllerClient client, String appName, LogsOffset offset); }
RecentLogsRetriever { public List<ApplicationLog> getRecentLogs(CloudControllerClient client, String appName, LogsOffset offset) { List<ApplicationLog> appLogs = client.getRecentLogs(appName); if (offset == null) { return appLogs; } return appLogs.stream() .filter(appLog -> isLogNew(appLog, offset)) .collect(Collectors.toList()); }  List<ApplicationLog> getRecentLogsSafely(CloudControllerClient client, String appName, LogsOffset offset); List<ApplicationLog> getRecentLogs(CloudControllerClient client, String appName, LogsOffset offset);  }