package com.oguerreiro.resilient.domain;

import static com.oguerreiro.resilient.domain.UnitConverterTestSamples.*;
import static com.oguerreiro.resilient.domain.UnitTestSamples.*;
import static org.assertj.core.api.Assertions.assertThat;

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

class UnitConverterTest {

    @Test
    void equalsVerifier() throws Exception {
        TestUtil.equalsVerifier(UnitConverter.class);
        UnitConverter unitConverter1 = getUnitConverterSample1();
        UnitConverter unitConverter2 = new UnitConverter();
        assertThat(unitConverter1).isNotEqualTo(unitConverter2);

        unitConverter2.setId(unitConverter1.getId());
        assertThat(unitConverter1).isEqualTo(unitConverter2);

        unitConverter2 = getUnitConverterSample2();
        assertThat(unitConverter1).isNotEqualTo(unitConverter2);
    }

    @Test
    void fromUnitTest() {
        UnitConverter unitConverter = getUnitConverterRandomSampleGenerator();
        Unit unitBack = getUnitRandomSampleGenerator();

        unitConverter.setFromUnit(unitBack);
        assertThat(unitConverter.getFromUnit()).isEqualTo(unitBack);

        unitConverter.fromUnit(null);
        assertThat(unitConverter.getFromUnit()).isNull();
    }

    @Test
    void toUnitTest() {
        UnitConverter unitConverter = getUnitConverterRandomSampleGenerator();
        Unit unitBack = getUnitRandomSampleGenerator();

        unitConverter.setToUnit(unitBack);
        assertThat(unitConverter.getToUnit()).isEqualTo(unitBack);

        unitConverter.toUnit(null);
        assertThat(unitConverter.getToUnit()).isNull();
    }
}
