2

I came up with an Apex Class to extract the User Profile Picture, to be used in a VisualForce Email Template :

public class UserProfilePicture {
    public String profileImageUrl { get; set; }
    List<user> lstuser;


    public UserProfilePicture () {
         lstuser = [select FullPhotoUrl from User where Id =: UserInfo.getUserId()];
         profileImageUrl=lstuser[0].FullPhotoUrl; 
    }
}

Can anyone please assist with a test for this class?

Thank you, Ido.

2

You really just need to test if the URL is populated, something like this:

@isTest static void test() {
    UserProfilePicture upp = new UserProfilePicture();
    System.assert(upp.profileImageUrl <> null);
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.