Refactoring assertFileHeaderWrittenFromList

Intermediate step