@Test(description = "Testing getting effective policy of a device when unable to retrieve effective policy")
public void testGetEffectivePolicyOfDeviceException() throws PolicyManagementException {

    PolicyManagerService policyManagerService = Mockito.mock(PolicyManagerService.class, Mockito.RETURNS_MOCKS);
    PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getPolicyManagementService"))
            .toReturn(policyManagerService);
    Mockito.when(policyManagerService.getAppliedPolicyToDevice(Mockito.any(DeviceIdentifier.class)))
            .thenThrow(new PolicyManagementException());
    Response response = this.deviceManagementService
            .getEffectivePolicyOfDevice(TEST_DEVICE_TYPE, UUID.randomUUID().toString(), null);
    Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),
            "Expects to return HTTP 500 when an exception occurred while getting effective policy of the device");
}