@Test public void getcoursesReturnEmptyListOnFailure() throws Exception { when(rb.getForText(any(String.class))).thenReturn(""); assertEquals(0, server.getCourses().size()); }
public List<Course> getCourses() { String url = connectionBuilder.getUrl(UrlExtension.COURSES.getExtension()); String bodyText = getString(url); CourseList cl = mapper.fromJson(bodyText, CourseList.class); if (cl == null) { return new ArrayList<Course>(); } return Arrays.asList(cl.getCourses()); }
ServerManager { public List<Course> getCourses() { String url = connectionBuilder.getUrl(UrlExtension.COURSES.getExtension()); String bodyText = getString(url); CourseList cl = mapper.fromJson(bodyText, CourseList.class); if (cl == null) { return new ArrayList<Course>(); } return Arrays.asList(cl.getCourses()); } }
ServerManager { public List<Course> getCourses() { String url = connectionBuilder.getUrl(UrlExtension.COURSES.getExtension()); String bodyText = getString(url); CourseList cl = mapper.fromJson(bodyText, CourseList.class); if (cl == null) { return new ArrayList<Course>(); } return Arrays.asList(cl.getCourses()); } ServerManager(Gson mapper, ConnectionBuilder connectionBuilder, Settings settings);  ServerManager(Settings settings); }
ServerManager { public List<Course> getCourses() { String url = connectionBuilder.getUrl(UrlExtension.COURSES.getExtension()); String bodyText = getString(url); CourseList cl = mapper.fromJson(bodyText, CourseList.class); if (cl == null) { return new ArrayList<Course>(); } return Arrays.asList(cl.getCourses()); } 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 List<Course> getCourses() { String url = connectionBuilder.getUrl(UrlExtension.COURSES.getExtension()); String bodyText = getString(url); CourseList cl = mapper.fromJson(bodyText, CourseList.class); if (cl == null) { return new ArrayList<Course>(); } return Arrays.asList(cl.getCourses()); } 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);  }