When your data contains quotes, CSV turns them into double quotes ("") and then wraps the whole field in quotes. So yes — CSV turns your input "foo014"
into """foo014"""
— that’s the correct and expected behavior.
"foo014"
Is interpreted as:
Quote → escape as ""
f
o
o
0
1
4
Quote → escape as ""
Then the entire field is wrapped in quotes, resulting in:
"""foo014"""
about your test: Your actual output is correct — the test expectation is wrong. To match Apache Commons CSV output, update your expected string to:
val expected = """
EPPN,FirstName,LastName,Email,ClassStanding,StudentID,Degree,College,Department,SuitableRole
"""foo014""",Foo,Bar,[email protected],,9200#8210,,,,ROLE_TENANT_ADVISOR
""".trimMargin()