@Test(description = "This method tests the functionality of updateGroup method under various conditions")
public void testUpdateGroup() throws GroupManagementException, GroupNotExistException {

    PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getGroupManagementProviderService"))
            .toReturn(groupManagementProviderService);
    DeviceGroup deviceGroup = new DeviceGroup();
    deviceGroup.setGroupId(1);
    Mockito.doNothing().when(groupManagementProviderService).updateGroup(deviceGroup, 1);
    Mockito.doThrow(new GroupManagementException()).when(groupManagementProviderService)
            .updateGroup(deviceGroup, 2);
    Mockito.doThrow(new GroupNotExistException()).when(groupManagementProviderService).updateGroup(deviceGroup, 3);
    Response response = groupManagementService.updateGroup(1, deviceGroup);
    Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode(),
            "update request failed for a request with valid parameters");
    response = groupManagementService.updateGroup(2, deviceGroup);
    Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),
            "update request succeeded for a in-valid request");
    response = groupManagementService.updateGroup(3, deviceGroup);
    Assert.assertEquals(response.getStatus(), Response.Status.CONFLICT.getStatusCode(),
            "update request succeeded for a in-valid request");
    response = groupManagementService.updateGroup(4, null);
    Assert.assertEquals(response.getStatus(), Response.Status.BAD_REQUEST.getStatusCode(),
            "update request succeeded for a in-valid request");
}