@Test(expected = UserVisibleException.class) public void exceptionIsThrownIfCourseIsNull() { updater.updateExercises(null); }
public void updateExercises(Course course) { if (course == null) { throw new UserVisibleException("Remember to select your course from TMC -> Settings"); } List<Exercise> oldExercises = course.getExercises(); List<Exercise> newExercises = server.getExercises(course.getId() + ""); for (Exercise newExercise : newExercises) { Exercise oldExercise = findEqualExercise(oldExercises, newExercise); if (oldExercise != null) { updateExercise(oldExercise, newExercise); } } course.setExercises(newExercises); }
Updater { public void updateExercises(Course course) { if (course == null) { throw new UserVisibleException("Remember to select your course from TMC -> Settings"); } List<Exercise> oldExercises = course.getExercises(); List<Exercise> newExercises = server.getExercises(course.getId() + ""); for (Exercise newExercise : newExercises) { Exercise oldExercise = findEqualExercise(oldExercises, newExercise); if (oldExercise != null) { updateExercise(oldExercise, newExercise); } } course.setExercises(newExercises); } }
Updater { public void updateExercises(Course course) { if (course == null) { throw new UserVisibleException("Remember to select your course from TMC -> Settings"); } List<Exercise> oldExercises = course.getExercises(); List<Exercise> newExercises = server.getExercises(course.getId() + ""); for (Exercise newExercise : newExercises) { Exercise oldExercise = findEqualExercise(oldExercises, newExercise); if (oldExercise != null) { updateExercise(oldExercise, newExercise); } } course.setExercises(newExercises); } Updater(ServerManager server, CourseDAO courseDAO, ProjectDAO projectDAO); }
Updater { public void updateExercises(Course course) { if (course == null) { throw new UserVisibleException("Remember to select your course from TMC -> Settings"); } List<Exercise> oldExercises = course.getExercises(); List<Exercise> newExercises = server.getExercises(course.getId() + ""); for (Exercise newExercise : newExercises) { Exercise oldExercise = findEqualExercise(oldExercises, newExercise); if (oldExercise != null) { updateExercise(oldExercise, newExercise); } } course.setExercises(newExercises); } Updater(ServerManager server, CourseDAO courseDAO, ProjectDAO projectDAO); void updateCourses(); void updateExercises(Course course); }
Updater { public void updateExercises(Course course) { if (course == null) { throw new UserVisibleException("Remember to select your course from TMC -> Settings"); } List<Exercise> oldExercises = course.getExercises(); List<Exercise> newExercises = server.getExercises(course.getId() + ""); for (Exercise newExercise : newExercises) { Exercise oldExercise = findEqualExercise(oldExercises, newExercise); if (oldExercise != null) { updateExercise(oldExercise, newExercise); } } course.setExercises(newExercises); } Updater(ServerManager server, CourseDAO courseDAO, ProjectDAO projectDAO); void updateCourses(); void updateExercises(Course course);  }