Better getEntityType error message and tests.