Most court-ordered urine sample collections are observed, making subbing not a viable option.
Read up on the Dilution sticky thread. Also, take a home THC test with your first mornings pee. If your home test is positive, your only recourse would be to make use of the Dilution technique for the day of the U/A....and PRAY!