CourseDescriptionBuilder { public String buildDescriptionFrom(CampusCourseImportTO campusCourseData, String language) { return buildDescriptionFrom(campusCourseData, null, language); } CourseDescriptionBuilder(); String buildDescriptionFrom(CampusCourseImportTO campusCourseData, String language); String buildDescriptionFrom(CampusCourseImportTO campusCourseData, String campusCourseMultiSemester, String language);  }
@Test public void buildDescriptionFrom() { String title = "Example title"; String semester = "Herbstsemester 2012"; String eventDescription = "Detail_description"; String[] argsMock = new String[3]; argsMock[0] = semester; argsMock[1] = LECTURE_SOLL; argsMock[2] = eventDescription; List<Identity> participants = new ArrayList<Identity>(); CampusCourseImportTO campusCourseData = new CampusCourseImportTO(title, semester, lecturers, participants, eventDescription, TEST_RESOURCEABLE_ID, null); Translator translatorMock = mock(Translator.class); courseDescriptionBuilder.translator = translatorMock; String descriptionSoll = semester + "/n/n" + LECTURE_SOLL + "/n/n" + eventDescription; when(translatorMock.translate(CourseDescriptionBuilder.KEY_DESCRIPTION_TEMPLATE, argsMock)).thenReturn(descriptionSoll); String generatedDescription = courseDescriptionBuilder.buildDescriptionFrom(campusCourseData, "de"); verify(translatorMock).translate(CourseDescriptionBuilder.KEY_DESCRIPTION_TEMPLATE, argsMock); }