Replacing some manual diagnostic checks with an existing helper method.  Adding missing test cases for the diagnostics.