use of android.telephony.ims.ImsMmTelManager.CapabilityCallback in project robolectric by robolectric.
the class ShadowImsMmTelManagerTest method registerMmTelCapabilityCallback_imsNotSupported_imsExceptionThrown.
@Test
public void registerMmTelCapabilityCallback_imsNotSupported_imsExceptionThrown() {
shadowImsMmTelManager.setImsAvailableOnDevice(false);
try {
shadowImsMmTelManager.registerMmTelCapabilityCallback(Runnable::run, new CapabilityCallback());
assertWithMessage("Expected ImsException was not thrown").fail();
} catch (ImsException e) {
assertThat(e.getCode()).isEqualTo(ImsException.CODE_ERROR_UNSUPPORTED_OPERATION);
assertThat(e).hasMessageThat().contains("IMS not available on device.");
}
}
use of android.telephony.ims.ImsMmTelManager.CapabilityCallback in project robolectric by robolectric.
the class ShadowImsMmTelManagerTest method registerMmTelCapabilityCallback_imsNotRegistered_availabilityChange_onCapabilitiesStatusChangedNotInvoked.
@Test
public void registerMmTelCapabilityCallback_imsNotRegistered_availabilityChange_onCapabilitiesStatusChangedNotInvoked() throws ImsException {
MmTelCapabilities[] mmTelCapabilities = new MmTelCapabilities[1];
CapabilityCallback capabilityCallback = new CapabilityCallback() {
@Override
public void onCapabilitiesStatusChanged(MmTelCapabilities capabilities) {
super.onCapabilitiesStatusChanged(capabilities);
mmTelCapabilities[0] = capabilities;
}
};
shadowImsMmTelManager.registerMmTelCapabilityCallback(Runnable::run, capabilityCallback);
shadowImsMmTelManager.setMmTelCapabilitiesAvailable(new MmTelCapabilities());
assertThat(mmTelCapabilities[0]).isNull();
}
use of android.telephony.ims.ImsMmTelManager.CapabilityCallback in project robolectric by robolectric.
the class ShadowImsMmTelManagerTest method registerMmTelCapabilityCallback_imsRegistered_availabilityChange_onCapabilitiesStatusChangedInvoked.
@Test
public void registerMmTelCapabilityCallback_imsRegistered_availabilityChange_onCapabilitiesStatusChangedInvoked() throws ImsException {
MmTelCapabilities[] mmTelCapabilities = new MmTelCapabilities[1];
CapabilityCallback capabilityCallback = new CapabilityCallback() {
@Override
public void onCapabilitiesStatusChanged(MmTelCapabilities capabilities) {
super.onCapabilitiesStatusChanged(capabilities);
mmTelCapabilities[0] = capabilities;
}
};
shadowImsMmTelManager.setImsRegistered(ImsRegistrationImplBase.REGISTRATION_TECH_LTE);
shadowImsMmTelManager.registerMmTelCapabilityCallback(Runnable::run, capabilityCallback);
MmTelCapabilities mmTelCapabilitiesWithCallbackRegistered = new MmTelCapabilities();
mmTelCapabilitiesWithCallbackRegistered.addCapabilities(MmTelCapabilities.CAPABILITY_TYPE_VIDEO);
mmTelCapabilitiesWithCallbackRegistered.addCapabilities(MmTelCapabilities.CAPABILITY_TYPE_VOICE);
shadowImsMmTelManager.setMmTelCapabilitiesAvailable(mmTelCapabilitiesWithCallbackRegistered);
assertThat(mmTelCapabilities[0]).isNotNull();
assertThat(mmTelCapabilities[0]).isEqualTo(mmTelCapabilitiesWithCallbackRegistered);
shadowImsMmTelManager.unregisterMmTelCapabilityCallback(capabilityCallback);
shadowImsMmTelManager.setMmTelCapabilitiesAvailable(new MmTelCapabilities());
assertThat(mmTelCapabilities[0]).isEqualTo(mmTelCapabilitiesWithCallbackRegistered);
}
Aggregations