@Test
public void testCreate() {

    AdminUserResource resource = new AdminUserResource();
    // Inject OSGi services into the resource
    UserManagementService useradmin = mock(UserManagementService.class);
    resource.useradmin = useradmin;
    UkelonnService ukelonn = mock(UkelonnService.class);
    resource.ukelonn = ukelonn;
    MockLogService logservice = new MockLogService();
    resource.logservice = logservice;
    // Save the number of users before adding a user
    int originalUserCount = getUsers().size();
    List<User> originalUsersPlusOne = new ArrayList<>(getUsersForUserManagement());
    // Create a user object
    String newUsername = "aragorn";
    String newEmailaddress = "strider@hotmail.com";
    String newFirstname = "Aragorn";
    String newLastname = "McArathorn";
    User user = new User(0, newUsername, newEmailaddress, newFirstname, newLastname);
    originalUsersPlusOne.add(user);
    when(useradmin.addUser(any())).thenReturn(originalUsersPlusOne);
    // Create a passwords object containing the user
    UserAndPasswords passwords = new UserAndPasswords(user, "zecret", "zecret", false);
    // Create a user
    List<User> updatedUsers = resource.create(passwords);
    // Verify that the modified user has the modified values
    assertThat(updatedUsers.size()).isGreaterThan(originalUserCount);
    User lastUser = updatedUsers.get(updatedUsers.size() - 1);
    assertEquals(newUsername, lastUser.getUsername());
    assertEquals(newEmailaddress, lastUser.getEmail());
    assertEquals(newFirstname, lastUser.getFirstname());
    assertEquals(newLastname, lastUser.getLastname());
}