All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.cucumber.scala.ScalaDataTableOptionalCellDefinition.scala Maven / Gradle / Ivy

package io.cucumber.scala

import io.cucumber.core.backend.ScenarioScoped
import io.cucumber.datatable.{DataTableType, TableCellTransformer}

trait ScalaDataTableOptionalCellDefinition[T]
    extends ScalaDataTableTypeDefinition {

  val details: ScalaDataTableOptionalCellTypeDetails[T]

  override val emptyPatterns: Seq[String] = details.emptyPatterns

  override val location: StackTraceElement = new Exception().getStackTrace()(3)

  private val transformer: TableCellTransformer[T] = (cell: String) => {
    details.body.transform(Option(replaceEmptyPatternsWithEmptyString(cell)))
  }

  override val dataTableType =
    new DataTableType(details.tag.runtimeClass, transformer)

}

class ScalaScenarioScopedDataTableOptionalCellDefinition[T](
    override val details: ScalaDataTableOptionalCellTypeDetails[T]
) extends ScalaDataTableOptionalCellDefinition[T]
    with ScenarioScoped {}

class ScalaGlobalDataTableOptionalCellDefinition[T](
    override val details: ScalaDataTableOptionalCellTypeDetails[T]
) extends ScalaDataTableOptionalCellDefinition[T] {}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy