/*
 * 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.system;

import com.arrebol.taxiservicios.model.core.Person;
import com.arrebol.taxiservicios.model.core.User;
import com.arrebol.taxiservicios.model.enums.UserStatusType;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;

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

    static public final String PERSON_ID = "1c73cf83-1609-4fd0-abbb-247a957aa72d";
    static public final String CREATED_BY = "09ea84b8-b9d1-4a71-adfe-db653b2a9982";
    static public final String USERNAME = "contador";
    static public final String AVATAR = "images/avatar/mask-power/mask-4.png";
    static public final String PWD = "5D50D9BB26F7158F3AF41FB6714758E65DD5E4FDB80D0E6B38ED66453E05FDB9";
    private UserController controller;
    private User user;
    private Person person;

    public SystemControllerTest() {
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Person getPerson() {
        return person;
    }

    public void setPerson(Person person) {
        this.person = person;
    }

    @Before
    public void setUp() {
        controller = new UserController();
        user = new User();
        person = new Person();
    }

    //@Test
    public void createUser() {
        try {
            getUser().setUserName(USERNAME);
            getUser().setId(UUID.randomUUID().toString());
            getUser().setPassword(PWD);
            getUser().setActive(true);
            getUser().setRoot(false);
            getUser().setUserStatusType(UserStatusType.ENABLED);
            getUser().setCreatedBy(CREATED_BY);
            getUser().setCreatedOn(new Date());

            //boolean success = controller.createUser(getUser(), PERSON_ID, AVATAR);//TESTING
            boolean success = true;

            assertEquals(true, success);
        } catch (Exception e) {
            assertNotNull(null);
        }
    }

    //@Test
    public void availableUserName() {
        try {
            assertTrue(controller.availableUserName(USERNAME));
        } catch (Exception e) {
            assertNotNull(null);
        }
    }

    //@Test
    public void getAllEmployeeWithoutUser() {
        try {
            List<Person> employees = controller.getAllEmployeeWithoutUser();

            employees.forEach(System.out::println);

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

}
