Normally, all Apex codes run in System mode, and therefore the current user’s various permissions and record sharing rules are not taken into consideration. The system method, System.runAs(),lets us write test methods that change user contexts to either an existing user or a new user. All of that user’s record sharing is then enforced. You can only use runAs in a test method. But runAs() does not validate CRUD or Field Level Security permissions.