Check the metadata contexts that are being finalized before attempting to finalize them
Add comments to clarify the purpose of test cases