A small service assembles a string for displaying a contact and marks which field was used as the source of the name. With incomplete data, the result sometimes looks wrong now.
formatContact accepts name: String, nickname: String, email: String | null.trim in this order: name, then nickname, then the local part of the email before @."Unknown"."<displayName> <emailOrDash> [<source>]".source must be one of: name, nickname, email, fallback.null for the email is allowed and must not cause an error.ContactService.demo().formatContact:name = " "
nickname = " Ada "
email = null
name = ""
nickname = ""
email = "sam@example.com"
nickname, not an empty name.null email, the service should return a string without an error, substituting - instead of the address.scala-cli test . or an equivalent test run in a single JVM processUse line comments to explain the problem, its impact, the fix and how to test it.