Know Your Rights
Actually, if a cop pulls you over and you do not let them check your trunk if they ask you can (and most likely will) be arrested. The cop pulling you over is their legal reason for searching your car. As for the pat down, if they feel something that feels like a weapon they can check your pockets and other belongings. If you resist, they can arrest you. There have been examples of both instances brought to court and the polices actions have been deemed legal by the courts.