@Test(description = "This method tests the behaviour of getGroupCount method under valid conditions and invalid "
        + "conditions")
public void testGetGroupCount() throws GroupManagementException {

    PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getGroupManagementProviderService"))
            .toReturn(groupManagementProviderService);
    PowerMockito.stub(PowerMockito.method(PrivilegedCarbonContext.class, "getThreadLocalCarbonContext"))
            .toReturn(context);
    Mockito.doReturn(2).when(groupManagementProviderService).getGroupCount(Mockito.anyString());
    Response response = groupManagementService.getGroupCount();
    Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode(),
            "GetGroupCount request failed with valid parameters");
    Mockito.reset(groupManagementProviderService);
    Mockito.doThrow(new GroupManagementException()).when(groupManagementProviderService)
            .getGroupCount(Mockito.anyString());
    response = groupManagementService.getGroupCount();
    Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),
            "GetGroupCount request succeeded with in-valid parameters");
}