CourseAttributeSynchronizer { public TitleAndDescriptionStatistik synchronizeTitleAndDescription(long sapCourseId, CampusCourseImportTO campusCourseTO) { boolean titleUpdated = synchronizeTitle(getCampusCourse(sapCourseId, campusCourseTO.getOlatResourceableId()), campusCourseTO.getTitle()); boolean descriptionUpdated = synchronizeDescription(getCampusCourse(sapCourseId, campusCourseTO.getOlatResourceableId()), courseDescriptionBuilder.buildDescriptionFrom(campusCourseTO, campusConfiguration.getTemplateLanguage(campusCourseTO.getLanguage()))); return new TitleAndDescriptionStatistik(titleUpdated, descriptionUpdated); }  TitleAndDescriptionStatistik synchronizeTitleAndDescription(long sapCourseId, CampusCourseImportTO campusCourseTO);  }
@Test public void synchronizeTitleAndDescription_nothingToUpdate() { CampusCourseImportTO campusCourseTO = new CampusCourseImportTO(title, semester, lecturers, participants, eventDescription, resourceableId); when(courseDescriptionBuilderMock.buildDescriptionFrom(campusCourseTO, "de")).thenReturn(campusCourseTO.getEventDescription()); when(campusConfigurationMock.getTemplateLanguage(campusCourseTO.getLanguage())).thenReturn("de"); TitleAndDescriptionStatistik titleAndDescriptionStatistik = courseAttributeSynchronizerTestObject.synchronizeTitleAndDescription(sapCampusCourseId, campusCourseTO); assertNotNull("Missing TitleAndDescriptionStatistik", titleAndDescriptionStatistik); assertFalse("Title should not be updated", titleAndDescriptionStatistik.isTitleUpdated()); assertFalse("Description should not be updated", titleAndDescriptionStatistik.isDescriptionUpdated()); }
@Test public void synchronizeTitleAndDescription_updateDescription() { CampusCourseImportTO campusCourseTO = new CampusCourseImportTO(title, semester, lecturers, participants, eventDescription + "_new", resourceableId); TitleAndDescriptionStatistik titleAndDescriptionStatistik = courseAttributeSynchronizerTestObject.synchronizeTitleAndDescription(sapCampusCourseId, campusCourseTO); assertNotNull("Missing TitleAndDescriptionStatistik", titleAndDescriptionStatistik); assertFalse("Title should not be updated", titleAndDescriptionStatistik.isTitleUpdated()); assertTrue("Description should be updated", titleAndDescriptionStatistik.isDescriptionUpdated()); }