Even if the PTO doesn't get involved, all patents get a pretty thorough pre-trial examination by the judge in the form of a Markman hearing to determine what the claims mean.
Yeah I meant more like medical examination, not entrance examination. It is generally a critical hearing because the strength of a patent often boils down to the meaning of individual claims. For example, a judge might have to define what words like "program" and "execute" mean, which can have far reaching consequences.
A judge also has the power to stop a patent from going to trial if some forms of invalidity can be shown, for example if the defense turns up prior art, or if turns out the inventors failed to file within one year of first publication or sale offer.