io.cucumber.scala.ScalaSnippet.scala Maven / Gradle / Ivy
package io.cucumber.scala
import java.lang.reflect.Type
import java.text.MessageFormat
import java.util.{Map => JMap}
import io.cucumber.core.backend.Snippet
import io.cucumber.datatable.DataTable
import scala.jdk.CollectionConverters._
object ScalaSnippet {
// Allows to use """ in """xxx"""" strings
val tripleDoubleQuotes = "\"\"\""
}
class ScalaSnippet extends Snippet {
import ScalaSnippet.tripleDoubleQuotes
override def template(): MessageFormat = {
new MessageFormat(
s"""{0}(${tripleDoubleQuotes}{1}${tripleDoubleQuotes}) '{' ({3}) =>
| // {4}
| throw new ${classOf[PendingException].getName}()
|'}'""".stripMargin
)
}
override def tableHint(): String = {
"""| // For automatic transformation, change DataTable to one of
| // E, List, List>, List