Add unit test for hasField method