@Test(description = "Get active policy if enrollment status removed should be return PolicyManagement exception" +
        " caused by InvalidDeviceException",dependsOnMethods = "addPolicy",expectedExceptions = PolicyManagementException.class)
public void getActivatePolicyForEnrolmentStatusAsRemoved() throws Exception {

    EnrolmentInfo.Status status =null;
    try{
        Device device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().
                getDevice(new DeviceIdentifier(DEVICE1, DEVICE_TYPE_A), false);
        status = device.getEnrolmentInfo().getStatus();
        device.getEnrolmentInfo().setStatus(EnrolmentInfo.Status.REMOVED);
        policyManagerService.getEffectivePolicy(new DeviceIdentifier(DEVICE1, DEVICE_TYPE_A));
    }catch (Exception e){
        Assert.assertTrue(e.getCause() instanceof InvalidDeviceException);
        throw e;
    }finally {
        if(status != null){
            DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().
                    getDevice(new DeviceIdentifier(DEVICE1, DEVICE_TYPE_A), false).getEnrolmentInfo().setStatus(status);
        }
    }
}