import com.mark.springbootmall.dto.PeopleDto;
import com.mark.springbootmall.model.People;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;

@SpringBootTest
class PeopleMapperTest {

    @Autowired
    private PeopleMapper peopleMapper;

    @Test
    public void testToDto() {
        // Create a People entity
        People people = new People();
        people.setId(1);
        people.setName("John Doe");
        people.setAge(30);
        people.setAddress("123 Main St");

        // Map to PeopleDto
        PeopleDto peopleDto = peopleMapper.toDto(people);

        // Assert the values are correctly mapped
        assertThat(peopleDto).isNotNull();
        assertEquals(peopleDto.getId(), people.getId());
        assertEquals(peopleDto.getName(), people.getName());
        assertEquals(peopleDto.getAge(), people.getAge());
        assertEquals(peopleDto.getAddress(), people.getAddress());
    }

}