CourseSynchronizer { public SynchronizedGroupStatistic synchronizeCourse(CampusCourseImportTO sapCourse) { if (sapCourse != null) { long resourceableId = sapCourse.getOlatResourceableId(); log.debug("synchronizeCourse sapCourseId=" + sapCourse.getSapCourseId() + " resourceableId=" + resourceableId); ICourse course = CourseFactory.loadCourse(resourceableId); commitDBImplTransaction(); log.debug("synchronizeCourse start for course=" + course.getCourseTitle()); log.debug("synchronizeCourse Lecturer size=" + sapCourse.getLecturers().size()); log.debug("synchronizeCourse Participants size=" + sapCourse.getParticipants().size()); courseGroupSynchronizer.addAllLecturesAsOwner(course, sapCourse.getLecturers()); SynchronizedGroupStatistic groupStatistic = courseGroupSynchronizer.synchronizeCourseGroups(course, sapCourse); commitDBImplTransaction(); log.debug("synchronizeCourse statistic=" + groupStatistic); if (campusConfiguration.isSynchronizeTitleAndDescriptionEnabled()) { log.debug("SynchronizeTitleAndDescription is enabled"); courseAttributeSynchronizer.synchronizeTitleAndDescription(sapCourse.getSapCourseId(), sapCourse); commitDBImplTransaction(); } return groupStatistic; } else { return SynchronizedGroupStatistic.createEmptyStatistic(); } }  SynchronizedGroupStatistic synchronizeCourse(CampusCourseImportTO sapCourse);  }
@Test public void synchronizeCourse_CouldNotFoundCourse() { DaoManager daoManagerMock = mock(DaoManager.class); when(daoManagerMock.getSapCampusCourse(NOT_EXISTING_SAP_COURSE_ID)).thenReturn(null); SynchronizedGroupStatistic statistic = courseSynchronizerTestObject.synchronizeCourse(null); assertNotNull(statistic); }