Skip to content

Instantly share code, notes, and snippets.

@arturaz
Created September 19, 2012 10:23
Show Gist options
  • Save arturaz/3748876 to your computer and use it in GitHub Desktop.
Save arturaz/3748876 to your computer and use it in GitHub Desktop.
class TimeFilterTest extends ProjectSpec {
lazy val time = 200
lazy val mode = Graph.ConnectionsMode.Driving
lazy val origin = Node.DegreeCoords(1.4, 7.8)
lazy val threshold = 500000
describe("instance") {
lazy val isochroneMock = mock[Isochrone]
lazy val instance = new TimeFilter(
time, mode, origin, threshold = threshold
) {
override protected lazy val isochrone = isochroneMock
}
describe("#contains") {
lazy val point = Node.DegreeCoords(32.4, -56.8)
lazy val node = new Node(point)
lazy val nodeSetMock = mock[NodeSet[Node]]
when(isochroneMock.pointSet).thenReturn(nodeSetMock)
it("should return true if pointset has the node") {
when(nodeSetMock.get(node, threshold)).thenReturn(Some(node))
instance.contains(point) should be === true
}
it("should return false if pointset doesn't have the node") {
when(nodeSetMock.get(node, threshold)).thenReturn(None)
instance.contains(point) should be === false
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment