@Test(description = "This test case tests handling DeviceManagementException when testing policy compliance",
      dependsOnMethods = "testIsCompliant2")
public void testIsCompliantThrowingDeviceManagementException() throws Exception {

    DeviceManagementProviderService serviceMock = mock(DeviceManagementProviderService.class);
    doThrow(new DeviceManagementException()).when(serviceMock).getDevice(any(DeviceIdentifier.class), anyBoolean());
    PolicyManagementDataHolder instance = PolicyManagementDataHolder.getInstance();
    DeviceManagementProviderService service = instance.getDeviceManagementService();
    instance.setDeviceManagementService(serviceMock);
    try {
        DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
        deviceIdentifier.setType(DEVICE_TYPE_E);
        deviceIdentifier.setId(String.valueOf(device5.getDeviceIdentifier()));
        monitoringManager.isCompliant(deviceIdentifier);
    } catch (Exception e) {
        if (!(e.getCause() instanceof DeviceManagementException)) {
            throw e;
        }
    } finally {
        instance.setDeviceManagementService(service);
    }
}