If you know whether or not they're going to look at your prick, that makes things a bit easier. If it is for a job or something that isn't authority based (meaning you're not in court or probation, obviously) then they are probably gonna walk you to a bathroom, hand you a cup, and be waiting outside with a temperature gun, before they seal it and send it off to a lab.
The way around this, and I've done it often, is to simply fill up a container of clean pee and keep it in the freezer to maintain freshness. You have a small container ~30ml or so, will be enough, and keep it in your armpit on the way to your test. This will keep it warm enough. The rest is self explanatory...
I have heard a method of having sodium hypochlorite (bleach) in some form and putting that in your dirty pee and this will destroy any alkaloid metabolites, but I have not tested it personally.
If they are going to check your prick and watch you pee, then beating that test is beyond me. I've never attempted it but they used to have a product called "the whizzinator" or something... just make sure you get the skin tone right.. and good luck.. :B