how to test for bacterial pneumonia