package com.capgemini.reports.reports.parameters.checker;

import com.capgemini.framework.teamcenter.exceptions.NoTeamcenterConnectionException;
import com.capgemini.framework.teamcenter.policies.PolicyLocation;
import com.capgemini.reports.AbstractTeamcenterTest;
import com.capgemini.reports.exceptions.InvalidUserInputException;
import org.junit.Test;


public class ObjectTypeCheckerTest extends AbstractTeamcenterTest {

    private static final String PART_ID = "350-290-601-0";

    /**
     * JUnit test.
     * 
     * @throws InvalidUserInputException should not happen
     * @throws NoTeamcenterConnectionException should not happen
     */
    @Test
    public void testCheckPartPass() throws InvalidUserInputException, NoTeamcenterConnectionException {
        new ObjectTypeChecker(PART_ID, "Part").check(getSession());
    }

    /**
     * JUnit test.
     * 
     * @throws InvalidUserInputException should not happen
     * @throws NoTeamcenterConnectionException should not happen
     */
    @Test
    public void testCheckPartAeroPass() throws InvalidUserInputException, NoTeamcenterConnectionException {
        new ObjectTypeChecker(PART_ID, "Part Aero").check(getSession());
    }

    /**
     * JUnit test.
     * 
     * @throws InvalidUserInputException should not happen
     * @throws NoTeamcenterConnectionException should not happen
     */
    @Test
    public void testCheckMultiPass() throws InvalidUserInputException, NoTeamcenterConnectionException {
        new ObjectTypeChecker(PART_ID, "Truc", "Machin", "Part Aero").check(getSession());
    }

    /**
     * JUnit test.
     * 
     * @throws InvalidUserInputException SHOULD HAPPEN!
     * @throws NoTeamcenterConnectionException should not happen
     */
    @Test(expected = InvalidUserInputException.class)
    public void testCheckPartAeroRevisionFail() throws InvalidUserInputException, NoTeamcenterConnectionException {
        new ObjectTypeChecker(PART_ID, "Part Aero Revision").check(getSession());
    }


    /**
     * JUnit test.
     * 
     * @throws InvalidUserInputException SHOULD HAPPEN!
     * @throws NoTeamcenterConnectionException should not happen
     */
    @Test(expected = InvalidUserInputException.class)
    public void testCheckPartFailNofilter() throws InvalidUserInputException, NoTeamcenterConnectionException {
        new ObjectTypeChecker(PART_ID).check(getSession());
    }

    /**
     * JUnit test.
     * 
     * @throws InvalidUserInputException SHOULD HAPPEN!
     * @throws NoTeamcenterConnectionException should not happen
     */
    @Test(expected = InvalidUserInputException.class)
    public void testCheckPartFail() throws InvalidUserInputException, NoTeamcenterConnectionException {
        new ObjectTypeChecker(PART_ID, "Truc", "Bidule").check(getSession());
    }

    @Override
    public PolicyLocation getPropertyPolicyIdentifier() {
        return DEFAULT_POLICY;
    }

}
