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 DocDrawingTest extends AbstractTeamcenterTest {
    private final String id = "00037481";
    private final String revision = "--A";
    private final String name = "00037481";
    private final String designationEN = "FAN CASE";
    private final String indicePlan = "-A";

    @Test
    public void testBuild() throws NoTeamcenterConnectionException {
        List<ItemRevision> results = new ItemRevisionQuery(getSession()).searchIDAndRevision(id, revision).findAll();
        DocDrawing test = new DocDrawing(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(indicePlan, test.getIndicePlan());
    }

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