}
private void registeredUserChecks(boolean receiveEmails) throws ActionException{
User registered = persistUser(receiveEmails);
SendInvitationActionHandler handler = injector.getInstance(SendInvitationActionHandler.class);
SendInvitationResult result = handler.execute(new SendInvitation(registered.getEmail()), mock(ExecutionContext.class));
assertEquals(true, result.isSent());
User fromDb = appEntity.find(User.class, registered.getEmail());
assertNotNull(fromDb);
assertEquals(registered.getUserId(), fromDb.getUserId());
assertEquals(registered.getAuthDomain(), fromDb.getAuthDomain());
assertEquals(receiveEmails, fromDb.isReceiveEmails());