Add tests for invalidate and finalize methods.