public Vertex createVertexWithIdentity(
      ITypedReferenceableInstance typedInstance, Set<String> superTypeNames) {
    final Vertex vertexWithIdentity =
        createVertexWithoutIdentity(
            typedInstance.getTypeName(), typedInstance.getId(), superTypeNames);

    // add identity
    final String guid = UUID.randomUUID().toString();
    setProperty(vertexWithIdentity, Constants.GUID_PROPERTY_KEY, guid);

    // add version information
    setProperty(vertexWithIdentity, Constants.VERSION_PROPERTY_KEY, typedInstance.getId().version);

    return vertexWithIdentity;
  }
  @Test
  public void test1() throws AtlasException {

    TypeSystem ts = getTypeSystem();

    defineDeptEmployeeTypes(ts);
    Referenceable hrDept = createDeptEg1(ts);
    ClassType deptType = ts.getDataType(ClassType.class, "Department");
    ITypedReferenceableInstance hrDept2 = deptType.convert(hrDept, Multiplicity.REQUIRED);

    Assert.assertEquals(
        hrDept2.toString(),
        "{\n"
            + "\tid : (type: Department, id: <unassigned>)\n"
            + "\tname : \thr\n"
            + "\temployees : \t[{\n"
            + "\tid : (type: Person, id: <unassigned>)\n"
            + "\tname : \tJohn\n"
            + "\tdepartment : (type: Department, id: <unassigned>)\n"
            + "\tmanager : (type: Manager, id: <unassigned>)\n"
            + "}, {\n"
            + "\tid : (type: Manager, id: <unassigned>)\n"
            + "\tsubordinates : \t[{\n"
            + "\tid : (type: Person, id: <unassigned>)\n"
            + "\tname : \tJohn\n"
            + "\tdepartment : (type: Department, id: <unassigned>)\n"
            + "\tmanager : (type: Manager, id: <unassigned>)\n"
            + "}]\n"
            + "\tname : \tJane\n"
            + "\tdepartment : (type: Department, id: <unassigned>)\n"
            + "\tmanager : <null>\n"
            + "\n"
            + "\tSecurityClearance : \t{\n"
            + "\t\tlevel : \t\t1\n"
            + "\t}}]\n"
            + "}");
  }