Added tests for handling null document posted to document api