@Test public void sendEventLogCallsAddApiCallQueryParameters() { String myUrl = "myUrl"; server.sendEventLogs(myUrl, new ArrayList<LoggableEvent>()); verify(connectionBuilder, times(1)).addApiCallQueryParameters(myUrl); }
public void sendEventLogs(String url, List<LoggableEvent> events) { String fullUrl = connectionBuilder.addApiCallQueryParameters(url); Map<String, String> extraHeaders = new LinkedHashMap<String, String>(); extraHeaders.put("X-Tmc-Version", "1"); extraHeaders.put("X-Tmc-Username", settings.getUsername()); extraHeaders.put("X-Tmc-Password", settings.getPassword()); byte[] data; try { data = eventListToPostBody(events); } catch (IOException e) { throw ExceptionUtils.toRuntimeException(e); } try { connectionBuilder.createConnection().rawPostForText(fullUrl, data, extraHeaders); } catch (Exception e) { throw new RuntimeException("An error occured while submitting snapshot: " + e.getMessage()); } }
ServerManager { public void sendEventLogs(String url, List<LoggableEvent> events) { String fullUrl = connectionBuilder.addApiCallQueryParameters(url); Map<String, String> extraHeaders = new LinkedHashMap<String, String>(); extraHeaders.put("X-Tmc-Version", "1"); extraHeaders.put("X-Tmc-Username", settings.getUsername()); extraHeaders.put("X-Tmc-Password", settings.getPassword()); byte[] data; try { data = eventListToPostBody(events); } catch (IOException e) { throw ExceptionUtils.toRuntimeException(e); } try { connectionBuilder.createConnection().rawPostForText(fullUrl, data, extraHeaders); } catch (Exception e) { throw new RuntimeException("An error occured while submitting snapshot: " + e.getMessage()); } } }
ServerManager { public void sendEventLogs(String url, List<LoggableEvent> events) { String fullUrl = connectionBuilder.addApiCallQueryParameters(url); Map<String, String> extraHeaders = new LinkedHashMap<String, String>(); extraHeaders.put("X-Tmc-Version", "1"); extraHeaders.put("X-Tmc-Username", settings.getUsername()); extraHeaders.put("X-Tmc-Password", settings.getPassword()); byte[] data; try { data = eventListToPostBody(events); } catch (IOException e) { throw ExceptionUtils.toRuntimeException(e); } try { connectionBuilder.createConnection().rawPostForText(fullUrl, data, extraHeaders); } catch (Exception e) { throw new RuntimeException("An error occured while submitting snapshot: " + e.getMessage()); } } ServerManager(Gson mapper, ConnectionBuilder connectionBuilder, Settings settings);  ServerManager(Settings settings); }
ServerManager { public void sendEventLogs(String url, List<LoggableEvent> events) { String fullUrl = connectionBuilder.addApiCallQueryParameters(url); Map<String, String> extraHeaders = new LinkedHashMap<String, String>(); extraHeaders.put("X-Tmc-Version", "1"); extraHeaders.put("X-Tmc-Username", settings.getUsername()); extraHeaders.put("X-Tmc-Password", settings.getPassword()); byte[] data; try { data = eventListToPostBody(events); } catch (IOException e) { throw ExceptionUtils.toRuntimeException(e); } try { connectionBuilder.createConnection().rawPostForText(fullUrl, data, extraHeaders); } catch (Exception e) { throw new RuntimeException("An error occured while submitting snapshot: " + e.getMessage()); } } ServerManager(Gson mapper, ConnectionBuilder connectionBuilder, Settings settings);  ServerManager(Settings settings); List<Course> getCourses(); List<Exercise> getExercises(String courseId); ZippedProject getExerciseZip(String zipUrl); SubmissionResponse uploadFile(Exercise exercise, byte[] data); SubmissionResponse uploadFile(Exercise exercise, byte[] data, Map<String, String> extraParams); SubmissionResult getSubmissionResult(URI resultURI); String submitFeedback(String answerUrl, List<FeedbackAnswer> answers); void sendEventLogs(String url, List<LoggableEvent> events); List<Review> downloadReviews(Course course); boolean markReviewAsRead(Review review); }
ServerManager { public void sendEventLogs(String url, List<LoggableEvent> events) { String fullUrl = connectionBuilder.addApiCallQueryParameters(url); Map<String, String> extraHeaders = new LinkedHashMap<String, String>(); extraHeaders.put("X-Tmc-Version", "1"); extraHeaders.put("X-Tmc-Username", settings.getUsername()); extraHeaders.put("X-Tmc-Password", settings.getPassword()); byte[] data; try { data = eventListToPostBody(events); } catch (IOException e) { throw ExceptionUtils.toRuntimeException(e); } try { connectionBuilder.createConnection().rawPostForText(fullUrl, data, extraHeaders); } catch (Exception e) { throw new RuntimeException("An error occured while submitting snapshot: " + e.getMessage()); } } ServerManager(Gson mapper, ConnectionBuilder connectionBuilder, Settings settings);  ServerManager(Settings settings); List<Course> getCourses(); List<Exercise> getExercises(String courseId); ZippedProject getExerciseZip(String zipUrl); SubmissionResponse uploadFile(Exercise exercise, byte[] data); SubmissionResponse uploadFile(Exercise exercise, byte[] data, Map<String, String> extraParams); SubmissionResult getSubmissionResult(URI resultURI); String submitFeedback(String answerUrl, List<FeedbackAnswer> answers); void sendEventLogs(String url, List<LoggableEvent> events); List<Review> downloadReviews(Course course); boolean markReviewAsRead(Review review);  }