Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2015
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. import org.apache.log4j.{Level, Logger}
  2. import org.specs2.mutable._
  3. import Predef.{conforms => _, _}
  4.  
  5. class ExampleTest extends Specification {
  6. Logger.getRootLogger.setLevel(Level.ERROR)
  7.  
  8. sequential
  9.  
  10. "the transformStream method" should {
  11. implicit val fun = Example.transformStream _
  12.  
  13. "with 10 identical records" should {
  14. val records = Seq.fill(10)("""{"item_id":"abc123","amount":1.23,"time":1431504603105}""")
  15. "return a single record with the correct total" in new spark(records) {
  16. collector.length mustEqual 1
  17. val output = collector.head
  18. output.total mustEqual BigDecimal(12.3)
  19. }
  20. }
  21.  
  22. "with invalid records" should {
  23. val records = Seq("this is not json", """{"this":"isn't in the right format"}""")
  24. "output no records" in new spark(records) {
  25. collector.length mustEqual 0
  26. }
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement