+ Start a Discussion
Ronaldo CostaRonaldo Costa 

ChatterAnswers AuthProvider Class

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.
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); 

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.