package com.capgemini.reports.documentationobjects;

import com.capgemini.framework.teamcenter.exceptions.NoTeamcenterConnectionException;
import com.capgemini.framework.teamcenter.policies.PolicyLocation;
import com.capgemini.framework.teamcenter.queries.saved.modelobject.ItemRevisionQuery;
import com.capgemini.reports.AbstractTeamcenterTest;
import com.teamcenter.soa.client.model.strong.ItemRevision;
import org.junit.Assert;
import org.junit.Test;

import java.util.List;

public class DocNormTest extends AbstractTeamcenterTest {

    private final String id = "000189";
    private final String revision = "A";
    private final String name = "PLAN SUPPORT";
    private final String designationEN = "-";
    private final String idOrigine = "PLAN-888-370-100-104";
    private final String securite = "";

    @Test
    public void testBuild() throws NoTeamcenterConnectionException {
        List<ItemRevision> results = new ItemRevisionQuery(getSession()).searchIDAndRevision(id, revision).findAll();
        Assert.assertFalse(results.isEmpty());
        DocNorm test = new DocNorm(getSession(), results.get(0));
        Assert.assertNotNull(test);
        Assert.assertEquals(id, test.getDocId());
        Assert.assertEquals(revision, test.getRevision());
        Assert.assertEquals(name, test.getName());
        Assert.assertEquals(designationEN, test.getDesignationEn());
        Assert.assertEquals(idOrigine, test.getIdOrigine());
        Assert.assertEquals(securite, test.getSensibiliteSecurite());
    }

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