assert_raise
Java例外を認識させるのに問題があります。
できます
assert_raise(NativeException) { @iter.next }
これは問題なく動作しますが、より具体的にしようとすると
java_import 'java.util.NoSuchElementException'
#...
assert_raise(NoSuchElementException) { @iter.next }
エラーが発生します
Should expect a class of exception, Java::JavaUtil::NoSuchElementException.
<nil> is not true.
ただし、begin/rescue/end
例外をキャッチするために使用できます。
assert(begin
@iter.next
false
rescue NoSuchElementException
true
end)
私が間違っていることはありますか、それともこれはの失敗Test::Unit
ですか?