@Test(description = "Testing changing device status when unable to change device status")
public void testChangeDeviceStatusWhenUnableToChangeStatus() throws DeviceManagementException {

    PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService"))
            .toReturn(this.deviceManagementProviderService);
    Mockito.when(this.deviceManagementProviderService
            .changeDeviceStatus(Mockito.any(DeviceIdentifier.class), Mockito.any()))
            .thenThrow(new DeviceManagementException());
    Response response = this.deviceManagementService
            .changeDeviceStatus(TEST_DEVICE_TYPE, UUID.randomUUID().toString(), EnrolmentInfo.Status.ACTIVE);
    Assert.assertEquals(response.getStatus(), Response.Status.BAD_REQUEST.getStatusCode());
    Mockito.reset(this.deviceManagementProviderService);
}