Created
January 24, 2013 15:57
-
-
Save tolitius/4623700 to your computer and use it in GitHub Desktop.
едем из Харькова в Париж через Сан Франциско
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.typesafe.training.scalatrain | |
import org.specs2.mutable._ | |
class TrainSpec extends Specification { | |
val kharkovStation = Station("Харьков") | |
val sfStation = Station("Сан Франциско") | |
val parisStation = Station("Париж") | |
val t1 = Time(11, 11) | |
val t2 = Time(12, 12) | |
val t3 = Time(13, 13) | |
"Train" should { | |
"throw IllegalArgumentException schedules that have less than 2 stations" in { | |
Train(1, "Hogwarts", Vector()) must throwA[IllegalArgumentException] | |
Train(2, "Hogwarts", Vector(t1 -> kharkovStation)) must throwA[IllegalArgumentException] | |
} | |
"be created properly with 2 or more schedule entries" in { | |
Train(3, "Hogwarts", Vector(t1 -> kharkovStation, t2 -> sfStation)).schedule.size ==== 2 | |
Train(4, "Hogwarts", Vector(t1 -> kharkovStation, t2 -> sfStation, t3 -> parisStation)).schedule.size ==== 3 | |
} | |
"be created properly with stations initialized correctly" in { | |
Train(3, "Hogwarts", Vector(t1 -> kharkovStation, t2 -> sfStation)).stations ==== List(Station("Харьков"), Station("Сан Франциско")) | |
Train(4, "Hogwarts", Vector(t1 -> kharkovStation, t2 -> sfStation, t3 -> parisStation)).stations ==== List(Station("Харьков"), Station("Сан Франциско"), Station("Париж")) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I like this syntax a bit more:
train.stations must contain(st1, st2).inOrder