Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refined assertion messages in BlockFetcherIteratorSuite.scala
  • Loading branch information
sarutak committed Jul 31, 2014
commit d353984031de1e8be0d6f70b92416f1842c7dc05
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,21 @@ class BlockFetcherIteratorSuite extends FunSuite with Matchers {
// 3rd getLocalFromDisk invocation should be failed
verify(blockManager, times(3)).getLocalFromDisk(any(), any())

(iterator.hasNext) should be(true)
assert(iterator.hasNext, "iterator should have 5 elements but actually has no elements")
// the 2nd element of the tuple returned by iterator.next should be defined when fetching successfully
(iterator.next._2.isDefined) should be(true)
(iterator.hasNext) should be(true)
(iterator.next._2.isDefined) should be(true)
(iterator.hasNext) should be(true)
assert(iterator.next._2.isDefined, "1st element should be defined but is not actually defined")
assert(iterator.hasNext, "iterator should have 5 elements but actually has 1 element")
assert(iterator.next._2.isDefined, "2nd element should be defined but is not actually defined")
assert(iterator.hasNext, "iterator should have 5 elements but actually has 2 elements")
// 3rd fetch should be failed
(iterator.next._2.isDefined) should be(false)
(iterator.hasNext) should be(true)
assert(!iterator.next._2.isDefined, "3nd element should not be defined but is actually defined")
assert(iterator.hasNext, "iterator should have 5 elements but actually has 3 elements")
// And then, all of local fetches should be failed
(iterator.next._2.isDefined) should be(false)
(iterator.hasNext) should be(true)
(iterator.next._2.isDefined) should be(false)
assert(!iterator.next._2.isDefined, "Rest of elements after non-defined element should not be defined " +
"but 4th element is actually defined")
assert(iterator.hasNext, "iterator should have 5 elements but actually has 4 elements")
assert(!iterator.next._2.isDefined, "Rest of elements after non-defined element should not be defined " +
"but 5th element is actually defined")
}


Expand Down Expand Up @@ -127,16 +129,16 @@ class BlockFetcherIteratorSuite extends FunSuite with Matchers {
// getLocalFromDis should be invoked for all of 5 blocks
verify(blockManager, times(5)).getLocalFromDisk(any(), any())

(iterator.hasNext) should be(true)
(iterator.next._2.isDefined) should be(true)
(iterator.hasNext) should be(true)
(iterator.next._2.isDefined) should be(true)
(iterator.hasNext) should be(true)
(iterator.next._2.isDefined) should be(true)
(iterator.hasNext) should be(true)
(iterator.next._2.isDefined) should be(true)
(iterator.hasNext) should be(true)
(iterator.next._2.isDefined) should be(true)
assert(iterator.hasNext, "iterator should have 5 elements but actually has no elements")
assert(iterator.next._2.isDefined, "All elements should be defined but 1st element is not actually defined")
assert(iterator.hasNext, "iterator should have 5 elements but actually has 1 element")
assert(iterator.next._2.isDefined, "All elements should be defined but 2nd element is not actually defined")
assert(iterator.hasNext, "iterator should have 5 elements but actually has 2 elements")
assert(iterator.next._2.isDefined, "All elements should be defined but 3rd element is not actually defined")
assert(iterator.hasNext, "iterator should have 5 elements but actually has 3 elements")
assert(iterator.next._2.isDefined, "All elements should be defined but 4th element is not actually defined")
assert(iterator.hasNext, "iterator should have 5 elements but actually has 4 elements")
assert(iterator.next._2.isDefined, "All elements should be defined but 5th element is not actually defined")
}

}