twitter/scalding — pull request #956 by galarragas (2014-07-11 21:22:33+00:00)
Title: Extending BddDsl for Typed API

I created a parallel trait TBddDsl that allow to write tests for code using the Typed API.

An example of the code you can write is:

```scala
case class UserInfo(name: String, gender: String, age: Int)
case class EstimatedContribution(name: String, suggestedPensionContributionPerMonth: Double)

class TypedApiTest extends Specification with TBddDsl {

"A test with a single source" should {

"accept an operation from working with a single tuple-typed pipe" in {
Given {
List(("Joe", "M", 40), ("Sarah", "F", 22))
} When {
in: TypedPipe[(String, String, Int)] =>
in.map[(String, Double)] { person =>
person match {
case (name, "M", age) => (name, (1000.0 / (72 - age)).toDouble)
case (name, _, age) => (name, (1000.0 / (80 - age)).toDouble)
}
}
} Then {
buffer: mutable.Buffer[(String, Double)] =>
buffer.toList mustEqual List(("Joe", 1000.0 / 32), ("Sarah", 1000.0 / 58))
}
}

"accept an operation from single case class-typed pipe" in {
Given {
List(UserInfo("Joe", "M", 40), UserInfo("Sarah", "F", 22))
} When {
in: TypedPipe[UserInfo] =>
in.map { person =>
person match {
case UserInfo(name, "M", age) => EstimatedContribution(name, (1000.0 / (72 - age)))
case UserInfo(name, _, age) => EstimatedContribution(name, (1000.0 / (80 - age)))
}
}
} Then {
buffer: mutable.Buffer[EstimatedContribution] =>
buffer.toList mustEqual List(EstimatedContribution("Joe", 1000.0 / 32), EstimatedContribution("Sarah", 1000.0 / 58))
}
}
}
}
```

I added this sample of code to the .md documentation file in the package directory