package com.oguerreiro.resilient.domain;

import static com.oguerreiro.resilient.domain.PeriodTestSamples.getPeriodRandomSampleGenerator;
import static com.oguerreiro.resilient.domain.PeriodVersionTestSamples.getPeriodVersionRandomSampleGenerator;
import static com.oguerreiro.resilient.domain.PeriodVersionTestSamples.getPeriodVersionSample1;
import static com.oguerreiro.resilient.domain.PeriodVersionTestSamples.getPeriodVersionSample2;
import static org.assertj.core.api.Assertions.assertThat;

import org.junit.jupiter.api.Test;

import com.oguerreiro.resilient.web.rest.TestUtil;

class PeriodVersionTest {

    @Test
    void equalsVerifier() throws Exception {
        TestUtil.equalsVerifier(PeriodVersion.class);
        PeriodVersion periodVersion1 = getPeriodVersionSample1();
        PeriodVersion periodVersion2 = new PeriodVersion();
        assertThat(periodVersion1).isNotEqualTo(periodVersion2);

        periodVersion2.setId(periodVersion1.getId());
        assertThat(periodVersion1).isEqualTo(periodVersion2);

        periodVersion2 = getPeriodVersionSample2();
        assertThat(periodVersion1).isNotEqualTo(periodVersion2);
    }

    @Test
    void periodTest() {
        PeriodVersion periodVersion = getPeriodVersionRandomSampleGenerator();
        Period periodBack = getPeriodRandomSampleGenerator();

        periodVersion.setPeriod(periodBack);
        assertThat(periodVersion.getPeriod()).isEqualTo(periodBack);

        periodVersion.period(null);
        assertThat(periodVersion.getPeriod()).isNull();
    }
}
