Question: public void changePassword(String newPassword) {} // Change the current user's password public void logout() {} // Log out the current user public void setCurrentUser(String username)

public void changePassword(String newPassword) {} // Change the current user's password

public void logout() {} // Log out the current user

public void setCurrentUser(String username) {} // A mutator you can use to write tests

// without simulating user input

Both changePassword and logout operate on the currentUser, so they do not take a username as a parameter. changePassword should modify the currentUsers password to be the given newPassword. logout should set the currentUser to null.

The setCurrentUser method should not be used by any other method in AccessControl, but may be very useful for writing test methods. You must implement it even if you do not use it in any test methods. (We may use it when testing your code.)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!