@Test(description = "Testing getting installed applications of a device when unable to fetch applications")
public void testGetInstalledApplicationsException() throws ApplicationManagementException {

    ApplicationManagementProviderService applicationManagementProviderService = Mockito
            .mock(ApplicationManagementProviderService.class, Mockito.RETURNS_MOCKS);
    PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getAppManagementService"))
            .toReturn(applicationManagementProviderService);
    Mockito.when(
            applicationManagementProviderService.getApplicationListForDevice(Mockito.any(DeviceIdentifier.class)))
            .thenThrow(new ApplicationManagementException());
    Response response = this.deviceManagementService
            .getInstalledApplications(TEST_DEVICE_TYPE, UUID.randomUUID().toString(), "", 10, 5);
    Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),
            "Expects HTTP 500 when an exception occurred while retrieving application list of the device");
}