@Test public void markReviewAsReadCallsPostForText() throws Exception { Review review = mock(Review.class); when(review.getUpdateUrl()).thenReturn("url"); server.markReviewAsRead(review); verify(rb, times(1)).postForText(anyString(), anyMap()); }
public boolean markReviewAsRead(Review review) { String fullUrl = connectionBuilder.addApiCallQueryParameters(review.getUpdateUrl() + ".json"); Map<String, String> extraParams = new HashMap<String, String>(); extraParams.put("_method", "put"); extraParams.put("mark_as_read", "1"); try { connectionBuilder.createConnection().postForText(fullUrl, extraParams); return true; } catch (Exception e) { return false; } }
ServerManager { public boolean markReviewAsRead(Review review) { String fullUrl = connectionBuilder.addApiCallQueryParameters(review.getUpdateUrl() + ".json"); Map<String, String> extraParams = new HashMap<String, String>(); extraParams.put("_method", "put"); extraParams.put("mark_as_read", "1"); try { connectionBuilder.createConnection().postForText(fullUrl, extraParams); return true; } catch (Exception e) { return false; } } }
ServerManager { public boolean markReviewAsRead(Review review) { String fullUrl = connectionBuilder.addApiCallQueryParameters(review.getUpdateUrl() + ".json"); Map<String, String> extraParams = new HashMap<String, String>(); extraParams.put("_method", "put"); extraParams.put("mark_as_read", "1"); try { connectionBuilder.createConnection().postForText(fullUrl, extraParams); return true; } catch (Exception e) { return false; } } ServerManager(Gson mapper, ConnectionBuilder connectionBuilder, Settings settings);  ServerManager(Settings settings); }
ServerManager { public boolean markReviewAsRead(Review review) { String fullUrl = connectionBuilder.addApiCallQueryParameters(review.getUpdateUrl() + ".json"); Map<String, String> extraParams = new HashMap<String, String>(); extraParams.put("_method", "put"); extraParams.put("mark_as_read", "1"); try { connectionBuilder.createConnection().postForText(fullUrl, extraParams); return true; } catch (Exception e) { return false; } } 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 boolean markReviewAsRead(Review review) { String fullUrl = connectionBuilder.addApiCallQueryParameters(review.getUpdateUrl() + ".json"); Map<String, String> extraParams = new HashMap<String, String>(); extraParams.put("_method", "put"); extraParams.put("mark_as_read", "1"); try { connectionBuilder.createConnection().postForText(fullUrl, extraParams); return true; } catch (Exception e) { return false; } } 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);  }