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 DocGeometryTest extends AbstractTeamcenterTest {

    private final String id = "DOC-00237937";
    private final String revision = "--A";
    private final String name = "DOC-00237937";
    private final String designationEN = "WASHERS";
    private final String indiceCartouche = "";

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

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