package com.oguerreiro.resilient.domain;

import static com.oguerreiro.resilient.domain.UnitTestSamples.getUnitRandomSampleGenerator;
import static com.oguerreiro.resilient.domain.UnitTestSamples.getUnitSample1;
import static com.oguerreiro.resilient.domain.UnitTestSamples.getUnitSample2;
import static com.oguerreiro.resilient.domain.UnitTypeTestSamples.getUnitTypeRandomSampleGenerator;
import static org.assertj.core.api.Assertions.assertThat;

import org.junit.jupiter.api.Test;

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

class UnitTest {

    @Test
    void equalsVerifier() throws Exception {
        TestUtil.equalsVerifier(Unit.class);
        Unit unit1 = getUnitSample1();
        Unit unit2 = new Unit();
        assertThat(unit1).isNotEqualTo(unit2);

        unit2.setId(unit1.getId());
        assertThat(unit1).isEqualTo(unit2);

        unit2 = getUnitSample2();
        assertThat(unit1).isNotEqualTo(unit2);
    }

    @Test
    void unitTypeTest() {
        Unit unit = getUnitRandomSampleGenerator();
        UnitType unitTypeBack = getUnitTypeRandomSampleGenerator();

        unit.setUnitType(unitTypeBack);
        assertThat(unit.getUnitType()).isEqualTo(unitTypeBack);

        unit.unitType(null);
        assertThat(unit.getUnitType()).isNull();
    }
}
