@Test void testGetRecentLogsWithError() { Mockito.when(client.getRecentLogs(APP_NAME)) .thenThrow(new HttpServerErrorException(HttpStatus.INTERNAL_SERVER_ERROR, "Something fails")); tester.test(() -> recentLogsRetriever.getRecentLogs(client, APP_NAME, null), new Expectation(Expectation.Type.EXCEPTION, "500 Something fails")); }
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);  }