package com.magistr.app.utils;

import com.magistr.app.model.AcademicYear;
import com.magistr.app.model.EducationForm;
import com.magistr.app.model.Speciality;
import com.magistr.app.model.SpecialtyProfile;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

class AcademicCalendarTitleBuilderTest {

    @Test
    void buildsTitleFromCalendarDimensions() {
        AcademicYear year = new AcademicYear();
        year.setTitle(" 2026-2027 ");
        Speciality speciality = new Speciality();
        speciality.setSpecialityCode(" 09.03.04 ");
        SpecialtyProfile profile = new SpecialtyProfile();
        profile.setName(" Программная инженерия ");
        EducationForm studyForm = new EducationForm();
        studyForm.setName(" Очная ");

        assertThat(AcademicCalendarTitleBuilder.build(year, speciality, profile, studyForm))
                .isEqualTo("09.03.04 — Программная инженерия — Очная — 2026-2027");
    }

    @Test
    void rejectsIncompleteDimensions() {
        assertThatThrownBy(() -> AcademicCalendarTitleBuilder.build(
                new AcademicYear(),
                new Speciality(),
                new SpecialtyProfile(),
                new EducationForm()
        ))
                .isInstanceOf(IllegalArgumentException.class)
                .hasMessage("Невозможно сформировать название календарного графика из выбранных параметров");
    }
}
