Code cleanup in serializer test