tests for document exists