Skip to main content
Hello all,

I''m having trouble with the following test class. I get an error on line ⌗15, "attempt to de-reference a null object".

Any thoughts please? I belive it has to do with the profile id, but I'm not sure.

@isTest

private class ChatterAnswersAuthProviderRegTest {

static testMethod void validateCreateUpdateUser() {

Auth.UserData userData = new Auth.UserData('00ej0000000jJMR', 'testFirst', 'testLast',

'testFirst testLast', 'no-reply@salesforce.com', null, 'testuserlong', 'en_US', 'facebook',

null, new Map<String, String>{'language' => 'en_US'});

ChatterAnswersAuthProviderRegistration reg = new ChatterAnswersAuthProviderRegistration();

User newUser = reg.createUser(null, userData);

System.assert(newUser == null);

Auth.UserData updateUserData = new Auth.UserData('00ej0000000jJMR', 'updatedFirst', 'updatedLast',

'updatedFirst updatedLast', 'no-reply@new.salesforce.com', null, 'testuserlong', 'en_US', 'facebook',

null, new Map<String, String>{'language' => 'en_US'});

reg.updateUser(newUser.iD, null, updateUserData);

}

}

Thanks!!
1 answer
  1. Jan 12, 2015, 6:20 AM
    Line 09, where you are checking that newuser should be equal to null, then line 15 would have newUser as null, so newUser.id would give a null pointer exception. 
0/9000