Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.3 kB
4
Indexable
Never
package br.com.senior.erpxcomven.pedido.converter.impl;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;

import java.util.UUID;

import org.junit.Before;
import org.junit.Test;

import br.com.senior.erpxcomven.foundation.E001pesEntity;
import br.com.senior.erpxcomven.pedido.Transporter;

public class TransporterConverterTest {

    private TransporterConverter transporterConverter;

    @Before
    public void setUp() {
        transporterConverter = new TransporterConverter();
    }

    @Test
    public void testConvertShouldReturnNullWhenTransporterIsNull() {
        Transporter dto = transporterConverter.convert(null);
        assertNull(dto);
    }

    @Test
    public void testConvertShouldReturnCorrectTransporterDto() {
        E001pesEntity transporter = new E001pesEntity();
        transporter.setId(UUID.randomUUID());
        transporter.setCodPes(1L);
        transporter.setApePes("Transporter description");

        Transporter dto = transporterConverter.convert(transporter);

        assertEquals(transporter.getId().toString(), dto.id);
        assertEquals(transporter.getCodPes().toString(), dto.code);
        assertEquals(transporter.getApePes(), dto.description);
    }

}