package java101.domain.notification.recipient;

import java101.domain.notification.Recipient;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import java.util.Arrays;
import java.util.Collection;

/**
 * Created by Ovais.Oozeer on 21/02/2017.
 */
@RunWith(Parameterized.class)
public class CtorRequiresFirstName {

    private static final String VALID_FIRST_NAME = "First name";
    private static final String VALID_LAST_NAME = "LAST NAME";
    private String nameParameter;
    private int VALID_ID = 0;

    @Parameterized.Parameters
    public static Collection argumentArray() {
        return Arrays.asList(new Object[][] {
                { null },
                { "" },
                { " " },
                { "\t" },
                { "\n" }
        });
    }

    public CtorRequiresFirstName(String name){
        nameParameter = name;
    }

    @Test(expected=IllegalArgumentException.class)
    public void testConstructor(){
        new Recipient(VALID_ID, nameParameter, VALID_LAST_NAME);
    }

    //Right now, this runs for each parameter. Can extract into own test class but seems like overkill
    @Test
    public void testConstructorPasses(){
        new Recipient(VALID_ID, VALID_FIRST_NAME, VALID_LAST_NAME);
    }
}