@Test(description = "This method tests the inviteToEnrollDevice method of UserManagementService",
        dependsOnMethods = "testGetUsers")
public void testInviteToEnrollDevice() {

    URL resourceUrl = ClassLoader.getSystemResource("testng.xml");
    System.setProperty("carbon.home", resourceUrl.getPath());
    PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getUserStoreManager"))
            .toReturn(this.userStoreManager);
    PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getAuthenticatedUser")).toReturn(TEST_USERNAME);
    PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceManagementService"))
            .toReturn(this.deviceManagementProviderService);
    EnrollmentInvitation enrollmentInvitation = new EnrollmentInvitation();
    List<String> recipients = new ArrayList<>();
    recipients.add(TEST_USERNAME);
    enrollmentInvitation.setDeviceType("android");
    enrollmentInvitation.setRecipients(recipients);
    Response response = userManagementService.inviteToEnrollDevice(enrollmentInvitation);
    Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode(),
            "Inviting users to enroll device failed");
}