package notTest;

public class Applicant {

    private String firstName;

    private final String lastName;

    public Applicant(final String firstName, final String lastName) {
        super();
        if ((firstName == null) || (lastName == null)) {
            throw new IllegalArgumentException(
                "All parameters must be non-null.");
        }
        this.firstName = firstName;
        this.lastName = lastName;
    }

    public String getFirstName() {
        return firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setFirstName(final String firstName) {
        if (firstName == null) {
            throw new IllegalArgumentException("First name must not be null.");
        }
        this.firstName = firstName;
    }

    public boolean equals(final Object object) {

        if (this == object) {
            return true;
        }
        if (object == null) {
            return false;
        }
        if (!(object instanceof Applicant)) {
            return false;
        }

        final Applicant other = (Applicant) object;

        return firstName.equals(other.firstName)
            && lastName.equals(other.lastName);
    }

    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + firstName.hashCode();
        result = prime * result + lastName.hashCode();
        return result;
    }
}
