// Given
ManagedObjectRepresentation mo = new ManagedObjectRepresentation();
String globalIdValue = "myGlobalIdValue";
mo.setId(new GId(globalIdValue));
ExternalIDRepresentation repToCreate = new ExternalIDRepresentation();
repToCreate.setManagedObject(mo);
ExternalIDRepresentation createdRep = new ExternalIDRepresentation();
identityApiRep.setExternalIdsOfGlobalId(TEMPLATE_URL);
when(templateUrlParser.replacePlaceholdersWithParams(TEMPLATE_URL, singletonMap("globalId", globalIdValue))).thenReturn(EXACT_URL);
when(restConnector.post(EXACT_URL, IdentityMediaType.EXTERNAL_ID, repToCreate)).thenReturn(createdRep);
// When
ExternalIDRepresentation result = identityApiImpl.create(repToCreate);
// Then
assertThat(result, sameInstance(createdRep));
}