package com.oguerreiro.resilient.domain;

import static com.oguerreiro.resilient.domain.OutputDataTestSamples.*;
import static com.oguerreiro.resilient.domain.PeriodTestSamples.*;
import static com.oguerreiro.resilient.domain.PeriodVersionTestSamples.*;
import static com.oguerreiro.resilient.domain.UnitTestSamples.*;
import static com.oguerreiro.resilient.domain.VariableTestSamples.*;
import static org.assertj.core.api.Assertions.assertThat;

import com.oguerreiro.resilient.web.rest.TestUtil;
import org.junit.jupiter.api.Test;

class OutputDataTest {

    @Test
    void equalsVerifier() throws Exception {
        TestUtil.equalsVerifier(OutputData.class);
        OutputData outputData1 = getOutputDataSample1();
        OutputData outputData2 = new OutputData();
        assertThat(outputData1).isNotEqualTo(outputData2);

        outputData2.setId(outputData1.getId());
        assertThat(outputData1).isEqualTo(outputData2);

        outputData2 = getOutputDataSample2();
        assertThat(outputData1).isNotEqualTo(outputData2);
    }

    @Test
    void variableTest() {
        OutputData outputData = getOutputDataRandomSampleGenerator();
        Variable variableBack = getVariableRandomSampleGenerator();

        outputData.setVariable(variableBack);
        assertThat(outputData.getVariable()).isEqualTo(variableBack);

        outputData.variable(null);
        assertThat(outputData.getVariable()).isNull();
    }

    @Test
    void periodTest() {
        OutputData outputData = getOutputDataRandomSampleGenerator();
        Period periodBack = getPeriodRandomSampleGenerator();

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

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

    @Test
    void periodVersionTest() {
        OutputData outputData = getOutputDataRandomSampleGenerator();
        PeriodVersion periodVersionBack = getPeriodVersionRandomSampleGenerator();

        outputData.setPeriodVersion(periodVersionBack);
        assertThat(outputData.getPeriodVersion()).isEqualTo(periodVersionBack);

        outputData.periodVersion(null);
        assertThat(outputData.getPeriodVersion()).isNull();
    }

    @Test
    void baseUnitTest() {
        OutputData outputData = getOutputDataRandomSampleGenerator();
        Unit unitBack = getUnitRandomSampleGenerator();

        outputData.setBaseUnit(unitBack);
        assertThat(outputData.getBaseUnit()).isEqualTo(unitBack);

        outputData.baseUnit(null);
        assertThat(outputData.getBaseUnit()).isNull();
    }
}
