/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.arrebol.taxiservicios.controller.admin;

import com.arrebol.taxiservicios.model.core.Address;
import com.arrebol.taxiservicios.model.core.ContactNumber;
import com.arrebol.taxiservicios.model.core.Person;
import com.arrebol.taxiservicios.model.enums.PersonType;
import java.util.List;
import java.util.Set;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 *
 * @author Picasso
 */
public class EmployeeControllerUnitTest {

    private static final String EMPLOYEE_ID = "dc8d5b82-24b1-4dee-a98b-cbbbae50a4cf";

    private EmployeeController controller;

    public EmployeeControllerUnitTest() {
    }

    @Before
    public void setUp() {
        controller = new EmployeeController();
    }

    //@Test
    public void getAllEmployees() {
        try {
            List<Person> employees = controller.getAllPersonByType(PersonType.EMPLOYEE, EMPLOYEE_ID);

            assertNotNull(employees);
        } catch (Exception e) {
            assertNotNull(null);
        }
    }

    //@Test
    public void getEmployeeById() {
        try {
            Person employee = controller.getPersonById(EMPLOYEE_ID);

            if (null != employee) {
                if (null != employee.getAddresses()) {
                    ((Set<Address>)employee.getAddresses()).forEach((addresse) -> {
                        System.out.println(addresse.getAddressGoogleMap());
                    });
                }
                if (null != employee.getContactNumbers()) {
                    ((Set<ContactNumber>) employee.getContactNumbers()).forEach((number) -> {
                        System.out.println(number.getPhone() + " " + number.getPhoneType());
                    });
                }
            }
            assertNotNull(employee);
        } catch (Exception e) {
            assertNotNull(null);
        }
    }

}
