Is there a test for prostatitis?

Yes. It depends as there are 4 types of prostatitis. History, symptoms, & urine culture will identify type's 1 & 2 as these are associated with bacterial infection. Urine obtained pre and post prostate massage will help identify types 3 & 4, but the distinction is less important as the managemen of both types 3 and 4 overlap.
No. There is no specific test to diagnose prostatitis. This is a clinical diagnosis. However, there are several tests generally performed to exclude other causes of the pain and discomfort that may accompany prostatitis.