Their test equipment is about the size of a meat thermometer, and they have magic tuning-fork-shaped thingies to repair the schtuff in place. It's 23rd century technology, after all. ;-)
Containment fields. ;-)
What I wonder is howcome in their space battles all the other ships are in the same plane as the Enterprise, with the same Z axis, and nobody deviates more than a few meters from Z=0. ;-)
Cheers! Rich