use of com.azure.android.communication.chat.implementation.models.CommunicationIdentifierModel in project azure-sdk-for-android by Azure.
the class CommunicationIdentifierConverterTests method serializeUnknown.
@Test
public void serializeUnknown() {
CommunicationIdentifierModel model = CommunicationIdentifierConverter.convert(new UnknownIdentifier(someId), logger);
assertEquals(someId, model.getRawId());
}
use of com.azure.android.communication.chat.implementation.models.CommunicationIdentifierModel in project azure-sdk-for-android by Azure.
the class CommunicationIdentifierConverterTests method serializeCommunicationUser.
@Test
public void serializeCommunicationUser() {
CommunicationIdentifierModel model = CommunicationIdentifierConverter.convert(new CommunicationUserIdentifier(someId), logger);
assertNotNull(model.getCommunicationUser());
assertEquals(someId, model.getCommunicationUser().getId());
}
use of com.azure.android.communication.chat.implementation.models.CommunicationIdentifierModel in project azure-sdk-for-android by Azure.
the class CommunicationIdentifierConverterTests method deserializeUnknown.
@Test
public void deserializeUnknown() {
CommunicationIdentifier unknownIdentifier = CommunicationIdentifierConverter.convert(new CommunicationIdentifierModel().setRawId(rawId), logger);
assertEquals(UnknownIdentifier.class, unknownIdentifier.getClass());
assertEquals(rawId, ((UnknownIdentifier) unknownIdentifier).getId());
}
use of com.azure.android.communication.chat.implementation.models.CommunicationIdentifierModel in project azure-sdk-for-android by Azure.
the class CommunicationIdentifierConverterTests method serializeMicrosoftTeamsUser.
@ParameterizedTest
@ValueSource(booleans = { true, false })
public void serializeMicrosoftTeamsUser(boolean isAnonymous) {
CommunicationIdentifierModel model = CommunicationIdentifierConverter.convert(new MicrosoftTeamsUserIdentifier(teamsUserId, isAnonymous).setRawId(rawId).setCloudEnvironment(CommunicationCloudEnvironment.DOD), logger);
assertNotNull(model.getMicrosoftTeamsUser());
assertEquals(teamsUserId, model.getMicrosoftTeamsUser().getUserId());
assertEquals(rawId, model.getRawId());
assertEquals(CommunicationCloudEnvironmentModel.DOD, model.getMicrosoftTeamsUser().getCloud());
assertEquals(isAnonymous, model.getMicrosoftTeamsUser().isAnonymous());
}
use of com.azure.android.communication.chat.implementation.models.CommunicationIdentifierModel in project azure-sdk-for-android by Azure.
the class CommunicationIdentifierConverterTests method deserializerThrowsWhenMoreThanOneNestedObjectsSet.
@Test
public void deserializerThrowsWhenMoreThanOneNestedObjectsSet() {
CommunicationIdentifierModel[] modelsWithTooManyNestedObjects = new CommunicationIdentifierModel[] { new CommunicationIdentifierModel().setRawId(rawId).setCommunicationUser(new CommunicationUserIdentifierModel().setId(someId)).setPhoneNumber(new PhoneNumberIdentifierModel().setValue(testPhoneNumber)), new CommunicationIdentifierModel().setRawId(rawId).setCommunicationUser(new CommunicationUserIdentifierModel().setId(someId)).setMicrosoftTeamsUser(new MicrosoftTeamsUserIdentifierModel().setUserId(teamsUserId).setIsAnonymous(true).setCloud(CommunicationCloudEnvironmentModel.PUBLIC)), new CommunicationIdentifierModel().setRawId(rawId).setPhoneNumber(new PhoneNumberIdentifierModel().setValue(testPhoneNumber)).setMicrosoftTeamsUser(new MicrosoftTeamsUserIdentifierModel().setUserId(teamsUserId).setIsAnonymous(true).setCloud(CommunicationCloudEnvironmentModel.PUBLIC)) };
Arrays.stream(modelsWithTooManyNestedObjects).forEach(identifierModel -> {
assertThrows(IllegalArgumentException.class, () -> {
CommunicationIdentifierConverter.convert(identifierModel, logger);
});
});
}
Aggregations