Remove duplicate code in unit tests carried in from main code.