@Test(description = "This method tests the behaviour of getGroups under valid conditions")
public void testGetGroups() throws GroupManagementException {

    PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getGroupManagementProviderService"))
            .toReturn(groupManagementProviderService);
    PowerMockito.stub(PowerMockito.method(PrivilegedCarbonContext.class, "getThreadLocalCarbonContext"))
            .toReturn(context);
    PaginationResult paginationResult = new PaginationResult();
    Mockito.doReturn(paginationResult).when(groupManagementProviderService)
            .getGroups(Mockito.anyString(), Mockito.any(GroupPaginationRequest.class));
    Response response = groupManagementService.getGroups("test", "admin", 0, 10);
    Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode(),
            "GetGroups request failed with valid parameters");
    Mockito.reset(groupManagementProviderService);
    List<DeviceGroup> deviceGroupList = new ArrayList<>();
    deviceGroupList.add(new DeviceGroup("test"));
    paginationResult.setData(deviceGroupList);
    paginationResult.setRecordsTotal(1);
    Mockito.doReturn(paginationResult).when(groupManagementProviderService)
            .getGroups(Mockito.anyString(), Mockito.any(GroupPaginationRequest.class));
    response = groupManagementService.getGroups("test", "admin", 0, 10);
    Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode(),
            "GetGroups request failed with valid parameters");
}